Skip to content

Commit

Permalink
Update to use alpine:15
Browse files Browse the repository at this point in the history
mongodb ext can be installed from alpine without need to compile from
source.
  • Loading branch information
glensc committed Feb 14, 2022
1 parent 448c6d7 commit 8c70034
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,11 @@
# build (build from source), prebuilt (use copy from last release image)
ARG BUILD_SOURCE=build

FROM alpine:3.12 AS alpine
FROM alpine:3.15 AS alpine

FROM alpine AS base
ENV PHP_INI_DIR /etc/php7

# ext-mongodb: build and stage
FROM base AS build-ext-mongodb
RUN apk add --no-cache alpine-sdk openssl-dev php7-dev php7-openssl php7-pear
RUN pecl install mongodb

FROM base AS stage-ext-mongodb
RUN apk add binutils

WORKDIR /build/etc/php7/conf.d
RUN echo extension=mongodb.so > mongodb.ini

WORKDIR /build/usr/lib/php7/modules
COPY --from=build-ext-mongodb /usr/lib/php7/modules/mongodb.so .
RUN strip *.so && chmod a+rx *.so

# php-fpm runtime
FROM base AS php-build
RUN set -x \
Expand All @@ -42,6 +27,7 @@ RUN set -x \
php-phar \
php-session \
php-simplexml \
php7-pecl-mongodb \
# Use www-data uid from alpine also present in docker php images
&& adduser -u 82 -D -S -G www-data www-data \
# Tweak php-fpm config
Expand Down Expand Up @@ -112,7 +98,6 @@ RUN install -d /cache -m 700

# runtime image from current build
FROM php AS runtime-build
COPY --from=stage-ext-mongodb /build /

ARG APPDIR=/var/www/xhgui
ARG WEBROOT=$APPDIR/webroot
Expand Down

0 comments on commit 8c70034

Please sign in to comment.