Skip to content

Instantly share code, notes, and snippets.

@kenichi
Created March 29, 2019 21:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kenichi/b00b7bc75e8c94e8d1984581f459039e to your computer and use it in GitHub Desktop.
Save kenichi/b00b7bc75e8c94e8d1984581f459039e to your computer and use it in GitHub Desktop.
example_php_fpm/Dockerfile
FROM php:7.2-fpm-alpine
# replace www-data(82:82) with www-data(1000:1000)
ARG NAME=www-data
ENV NAME ${NAME}
RUN deluser www-data && \
adduser -s /bin/sh -D -u 1000 -g '' ${NAME} ${NAME} && \
chown -R ${NAME}:${NAME} /home/${NAME}
# needed packages
RUN apk add --no-cache autoconf g++ libtool make pcre-dev \
postgresql-dev \
zlib-dev
# install required php extensions
RUN docker-php-ext-install bcmath \
iconv \
opcache \
pdo pdo_pgsql pgsql \
zip
# opcache config
COPY opcache-recommended.ini /usr/local/etc/php/conf.d/
# laravel config
COPY laravel.ini /usr/local/etc/php/conf.d/
COPY xlaravel.pool.conf /usr/local/etc/php-fpm.d/
# clean
RUN apk del autoconf g++ libtool make pcre-dev
RUN rm -rf /tmp/* /var/cache/apk/*
# no USER is needed, since php will setuid
WORKDIR /var/www
CMD ["php-fpm"]
EXPOSE 9000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment