-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathDockerfile
111 lines (76 loc) · 2.38 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#
# Base build (common steps)
#
FROM php:8.3-fpm-alpine3.20 AS base
ENV TZ=UTC
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
RUN install-php-extensions @composer gd curl xml zip mbstring pdo_mysql apcu redis
RUN apk add --no-cache zip git curl bash \
supervisor \
caddy \
nodejs npm \
supercronic \
su-exec \
mariadb-client \
restic
# Set up App user
RUN mkdir -p /var/app/www \
&& addgroup -g 1000 app \
&& adduser -u 1000 -G app -h /var/app/ -s /bin/sh -D app \
&& addgroup app www-data \
&& mkdir -p /var/app/media /var/app/www /var/app/ssl /var/app/www_tmp /run/supervisord /logs \
&& chown -R app:app /var/app /logs
COPY --chown=app:app ./build/scripts/ /usr/local/bin
RUN chmod a+x /usr/local/bin/*
COPY ./build/supervisord.conf /etc/supervisord.conf
COPY ./build/services/ /etc/supervisor.d/
COPY --chown=app:app ./build/cron /etc/cron.d/app
COPY ./build/phpfpmpool.conf /usr/local/etc/php-fpm.d/www.conf
COPY ./build/php.ini /usr/local/etc/php/php.ini
VOLUME ["/var/app/www_tmp"]
VOLUME ["/var/app/media"]
EXPOSE 8080
#
# Development Build
#
FROM base AS development
COPY ./build/dev/services/ /etc/supervisor.d/
COPY ./build/dev/Caddyfile /etc/Caddyfile
COPY ./build/dev/entrypoint.sh /var/app/entrypoint.sh
RUN chmod a+x /var/app/entrypoint.sh
RUN apk add --no-cache shadow
WORKDIR /var/app/www
ENV APPLICATION_ENV=development
ENTRYPOINT ["/var/app/entrypoint.sh"]
CMD ["supervisord", "-c", "/etc/supervisord.conf"]
#
# CI/Testing Build
#
FROM base AS testing
COPY ./build/testing/entrypoint.sh /var/app/entrypoint.sh
RUN chmod a+x /var/app/entrypoint.sh
ENV APPLICATION_ENV=testing
WORKDIR /var/app/www
COPY --chown=app:app . .
ENTRYPOINT ["/var/app/entrypoint.sh"]
CMD ["app_ci"]
#
# Production Build
#
FROM base AS production
COPY ./build/prod/Caddyfile /etc/Caddyfile
COPY ./build/prod/entrypoint.sh /var/app/entrypoint.sh
RUN chmod a+x /var/app/entrypoint.sh
USER app
WORKDIR /var/app/www
COPY --chown=app:app . .
RUN composer install --no-dev --no-ansi --no-autoloader --no-interaction \
&& composer dump-autoload --optimize --classmap-authoritative \
&& composer clear-cache
RUN npm ci --include=dev \
&& npm run build \
&& npm cache clean --force
USER root
ENV APPLICATION_ENV=production
ENTRYPOINT ["/var/app/entrypoint.sh"]
CMD ["supervisord", "-c", "/etc/supervisord.conf"]