-
Notifications
You must be signed in to change notification settings - Fork 20
/
Dockerfile
52 lines (41 loc) · 1.32 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#
# container
# @see https://hub.docker.com/repository/docker/cnizzardini/php-fpm-alpine
# @see https://github.com/cnizzardini/php-fpm-alpine/tree/php-8.1
FROM cnizzardini/php-fpm-alpine:8.1-latest AS cakephp_php
ARG ENV=prod
ARG UID=1000
ARG HOST_OS=Linux
ENV APP_ENV=$ENV
ENV HOST_OS=$HOST_OS
#
# dev/test depdencies
#
RUN if [[ "$ENV" != "prod" ]]; then \
apk add git \
&& apk add --update --no-cache --virtual .php-deps file re2c autoconf make zlib zlib-dev g++ curl linux-headers \
&& pecl install xdebug \
&& docker-php-ext-enable xdebug \
&& apk del -f .php-deps; \
fi
#
# application
#
COPY .docker/php/docker-healthcheck.sh /usr/local/bin/docker-healthcheck
RUN chmod +x /usr/local/bin/docker-healthcheck
HEALTHCHECK --interval=10s --timeout=3s --retries=3 CMD ["docker-healthcheck"]
COPY .docker/php/docker-entrypoint.sh /usr/local/bin/docker-entrypoint
RUN chmod +x /usr/local/bin/docker-entrypoint
COPY .assets /srv/.assets
WORKDIR /srv/app
RUN adduser --disabled-password --gecos '' -u $UID cakephp;
RUN addgroup -g 101 nginx
RUN addgroup cakephp nginx
RUN addgroup cakephp www-data
COPY --from=composer /usr/bin/composer /usr/bin/composer
COPY app .
RUN if [[ "$ENV" = "prod" ]]; then \
composer install --prefer-dist --no-interaction --no-dev; \
fi
ENTRYPOINT ["docker-entrypoint"]
CMD ["php-fpm"]