php/Dockerfile

89 lines
2.3 KiB
Docker
Raw Normal View History

2021-03-28 18:50:39 +00:00
ARG PHP_VERSION=7.4-fpm-alpine3.13
2021-07-02 19:42:59 +00:00
FROM paramah/base:alpine as base-config
2021-03-28 18:50:39 +00:00
#
# Build php extenstions
#
#==================================================
FROM php:${PHP_VERSION} as builder
2021-07-02 14:09:52 +00:00
RUN apk add --no-cache --virtual build-essentials \
icu-dev icu-libs zlib-dev g++ make automake autoconf libzip-dev \
libpng-dev libwebp-dev libjpeg-turbo-dev freetype-dev \
wget \
2021-03-28 18:50:39 +00:00
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 \
2021-06-14 14:53:17 +00:00
libzip libzip-dev zip \
freetype-dev \
libpng-dev \
jpeg-dev \
libjpeg-turbo-dev
2021-06-14 16:26:16 +00:00
COPY docker/ /
2021-07-02 14:09:52 +00:00
# Configure & install php extensions
2021-06-14 16:26:16 +00:00
RUN /usr/local/bin/php_configure.sh
2021-03-28 18:50:39 +00:00
#
# Final image
#
#==================================================
FROM php:${PHP_VERSION}
ARG ENVIRONMENT=production
2021-03-28 18:50:39 +00:00
2021-06-15 15:02:38 +00:00
# Add testing alpine repository
RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && apk update
2021-06-15 15:02:38 +00:00
2021-03-28 18:50:39 +00:00
# install system libs
2021-08-21 13:51:12 +00:00
RUN apk add --no-cache libintl c-client libpng icu-libs libldap libpq libjpeg freetype libzip shadow sudo wget bash git openssh supervisor nginx openssl zip fluent-bit \
&& apk --no-cache upgrade && rm -rf /var/cache/apk/*
2021-06-14 14:31:33 +00:00
2021-03-28 18:50:39 +00:00
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
# Copy base files to docker container
COPY docker/ /
#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
# Create directories
2021-08-21 13:51:12 +00:00
RUN mkdir -p ${DIR}
2021-03-28 18:50:39 +00:00
WORKDIR $DIR
# Copy base configuration files
COPY docker/etc /etc/
EXPOSE 80
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"]