Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pdo drivers to docker image #323

Merged
merged 3 commits into from
Sep 14, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,18 @@
FROM php:7.3-fpm-alpine AS base

RUN set -x \
&& apk add --no-cache --virtual .build-deps ${PHPIZE_DEPS} \
&& apk add --no-cache --virtual .build-deps ${PHPIZE_DEPS} postgresql-dev \
&& pecl install mongodb && docker-php-ext-enable mongodb \
&& apk del .build-deps
&& docker-php-ext-install pdo pdo_mysql pdo_pgsql \
# https://github.com/docker-library/php/blob/c8c4d223a052220527c6d6f152b89587be0f5a7c/7.3/alpine3.12/fpm/Dockerfile#L166-L172
&& runDeps="$( \
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \
| tr ',' '\n' \
| sort -u \
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
)" \
&& apk add --no-cache $runDeps \
&& apk del .build-deps

# prepare sources
FROM scratch AS source
Expand All @@ -21,7 +30,7 @@ WORKDIR /app/vendor
FROM base AS build
WORKDIR /app
ARG COMPOSER_FLAGS="--no-interaction --no-suggest --ansi --no-dev"
COPY --from=composer:1.8 /usr/bin/composer /usr/bin/
COPY --from=composer:1.10 /usr/bin/composer /usr/bin/

COPY --from=source /app/composer.* ./
COPY --from=source /app/vendor ./vendor
Expand Down