-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
72 lines (53 loc) · 1.62 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
FROM node:lts-alpine AS node
WORKDIR /node
COPY ./ ./
RUN npm config set fetch-retry-mintimeout 20000
RUN npm config set fetch-retry-maxtimeout 120000
RUN npm cache verify
RUN npm install -g npm@latest
# RUN npm install -g pnpm
RUN npm clean-install
RUN npm run build
FROM composer:2.2 AS composer
WORKDIR /composer
# copying the source directory and install the dependencies with composer
COPY ./ ./
COPY --from=node /node/app/view/www ./app/view/www
# run composer install to install the dependencies
RUN composer install \
--optimize-autoloader \
--no-interaction \
--no-progress
RUN rm -rf views && \
rm -rf node_modules
# continue stage build with the desired image and copy the source including the
# dependencies downloaded by composer
FROM trafex/php-nginx:2.5.0 AS runner
ARG APP_TZ
ARG APP_PORT
WORKDIR /web
COPY --from=composer /composer /web
COPY --from=composer /composer/webman.nginx.conf /etc/nginx/conf.d/default.conf.template
COPY --from=composer /composer/webman.supervisord.conf /etc/supervisor/conf.d/supervisord.conf
USER root
RUN apk update &&\
# Packages
apk add -U --no-cache \
php8-posix \
php8-pcntl \
tzdata \
openrc \
lsof \
gettext \
&& \
# clear cache
rm -rf /var/cache/apk/*
ENV TZ=${APP_TZ:-"UTC"}
RUN ln -fs "/usr/share/zoneinfo/${TZ}" /etc/localtime && \
echo "${TZ}" > /etc/timezone
ENV APP_PORT=${APP_PORT:-"8787"}
RUN envsubst '\$APP_PORT' < /etc/nginx/conf.d/default.conf.template > /etc/nginx/conf.d/default.conf
RUN chown -R nobody:nobody /web
RUN chmod -R 755 /web
USER nobody
CMD ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisor/conf.d/supervisord.conf"]