2021-03-28 18:50:39 +00:00
|
|
|
ARG PHP_VERSION=7.4-fpm-alpine3.13
|
|
|
|
|
|
|
|
FROM paramah/base:alpine as base-config
|
|
|
|
|
|
|
|
#
|
|
|
|
# Build php extenstions
|
|
|
|
#
|
|
|
|
#==================================================
|
|
|
|
FROM php:${PHP_VERSION} as builder
|
|
|
|
|
|
|
|
RUN apk add --no-cache wget \
|
|
|
|
curl \
|
|
|
|
bash \
|
|
|
|
git \
|
|
|
|
openssh \
|
|
|
|
openssl \
|
|
|
|
bzip2-dev \
|
|
|
|
curl-dev \
|
|
|
|
libpng libpng-dev \
|
|
|
|
icu-dev \
|
|
|
|
gettext gettext-dev \
|
|
|
|
imap-dev \
|
|
|
|
ldb-dev libldap openldap-dev \
|
|
|
|
oniguruma-dev \
|
|
|
|
postgresql-dev \
|
|
|
|
sqlite sqlite-dev \
|
|
|
|
libxml2-dev \
|
|
|
|
libzip libzip-dev zip
|
|
|
|
|
|
|
|
# Install php extensions
|
|
|
|
RUN docker-php-ext-install -j$(nproc) \
|
2021-04-05 17:29:59 +00:00
|
|
|
calendar \
|
2021-03-28 18:50:39 +00:00
|
|
|
bcmath \
|
|
|
|
bz2 \
|
|
|
|
curl \
|
|
|
|
fileinfo \
|
|
|
|
gd \
|
|
|
|
gettext \
|
|
|
|
iconv \
|
|
|
|
imap \
|
|
|
|
intl \
|
|
|
|
json \
|
|
|
|
ldap \
|
|
|
|
mbstring \
|
|
|
|
opcache \
|
|
|
|
pcntl \
|
|
|
|
pdo \
|
|
|
|
pdo_mysql \
|
|
|
|
pdo_pgsql \
|
|
|
|
pdo_sqlite \
|
|
|
|
pgsql \
|
|
|
|
phar \
|
|
|
|
session \
|
|
|
|
simplexml \
|
|
|
|
soap \
|
|
|
|
xml \
|
|
|
|
zip
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Final image
|
|
|
|
#
|
|
|
|
#==================================================
|
|
|
|
FROM php:${PHP_VERSION}
|
2021-04-05 14:01:36 +00:00
|
|
|
ARG ENVIRONMENT=production
|
2021-03-28 18:50:39 +00:00
|
|
|
|
|
|
|
# install system libs
|
|
|
|
RUN apk add --no-cache libintl c-client libpng icu-libs libldap libpq libzip
|
|
|
|
|
|
|
|
# Install apps
|
|
|
|
RUN apk add --no-cache wget curl bash git openssh supervisor nginx openssl zip
|
|
|
|
|
|
|
|
ENV DIR /var/www
|
|
|
|
ENV DOCKERIZE_VERSION v0.6.1
|
|
|
|
|
|
|
|
# Install dockerize
|
|
|
|
RUN wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
|
|
|
|
&& tar -C /usr/local/bin -xzvf dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
|
|
|
|
&& rm dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz
|
|
|
|
|
|
|
|
COPY --from=base-config /etc/supervisor /etc/supervisor
|
|
|
|
COPY --from=builder /usr/local/lib/php /usr/local/lib/php
|
|
|
|
COPY --from=builder /usr/local/etc /usr/local/etc
|
|
|
|
|
2021-04-05 14:01:36 +00:00
|
|
|
# Copy base files to docker container
|
|
|
|
COPY docker/ /
|
2021-04-05 12:38:07 +00:00
|
|
|
|
2021-04-05 14:01:36 +00:00
|
|
|
#PHP helper
|
|
|
|
RUN /usr/local/bin/php_helper.sh
|
2021-03-28 18:50:39 +00:00
|
|
|
|
|
|
|
#install cachetool
|
|
|
|
RUN wget -O /bin/cachetool http://gordalina.github.io/cachetool/downloads/cachetool.phar
|
|
|
|
RUN chmod a+x /bin/cachetool
|
|
|
|
|
|
|
|
#install phpunit
|
|
|
|
RUN wget -O phpunit https://phar.phpunit.de/phpunit-9.phar
|
|
|
|
RUN install phpunit /usr/local/bin
|
|
|
|
|
|
|
|
# Create directories
|
|
|
|
RUN mkdir -p /var/www
|
|
|
|
|
|
|
|
WORKDIR $DIR
|
|
|
|
|
|
|
|
# Copy base configuration files
|
|
|
|
COPY docker/etc /etc/
|
|
|
|
|
|
|
|
|
|
|
|
EXPOSE 80
|
|
|
|
|
|
|
|
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"]
|