Skip to content

Instantly share code, notes, and snippets.

@leandrodaf
Last active April 29, 2020 00:23
Show Gist options
  • Save leandrodaf/be782c92c52c4d06d3371607095992fe to your computer and use it in GitHub Desktop.
Save leandrodaf/be782c92c52c4d06d3371607095992fe to your computer and use it in GitHub Desktop.
Development - Dockerfile PHP 7.4 - Lumen
FROM php:7.4-fpm-alpine
ARG HOST_UID=${HOST_UID}
ARG HOST_USER=${HOST_USER}
# Install dev dependencies
RUN apk add --no-cache --virtual .build-deps \
curl-dev \
imagemagick-dev \
libtool \
libxml2-dev \
postgresql-dev \
sqlite-dev
# Install production dependencies
RUN apk add --no-cache \
bash \
curl \
freetype-dev \
g++ \
gcc \
git \
imagemagick \
libc-dev \
libjpeg-turbo-dev \
libpng-dev \
libzip-dev \
make \
mysql-client \
oniguruma-dev \
openssh-client \
postgresql-libs \
zlib-dev
# Install PECL and PEAR extensions
RUN pecl install \
imagick \
xdebug \
redis
# Enable PECL and PEAR extensions
RUN docker-php-ext-enable \
imagick \
xdebug \
redis
# Configure php extensions
RUN docker-php-ext-configure gd --with-freetype --with-jpeg
# Install php extensions
RUN docker-php-ext-install \
bcmath \
calendar \
curl \
exif \
gd \
iconv \
mbstring \
pdo \
pdo_mysql \
pdo_pgsql \
pdo_sqlite \
pcntl \
tokenizer \
xml \
zip
# Install composer
ENV COMPOSER_HOME /composer
ENV PATH ./vendor/bin:/composer/vendor/bin:$PATH
ENV COMPOSER_ALLOW_SUPERUSER 1
RUN curl -s https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin/ --filename=composer
# Cleanup dev dependencies
RUN apk del -f .build-deps
RUN [ "${HOST_USER}" == "root" ] || \
(adduser -h /home/${HOST_USER} -D -u ${HOST_UID} ${HOST_USER} \
&& mkdir -p /home/$HOST_USER \
&& chown -R "${HOST_UID}:${HOST_UID}" /home/${HOST_USER})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment