-
Notifications
You must be signed in to change notification settings - Fork 9
/
Dockerfile.app
42 lines (41 loc) · 1.52 KB
/
Dockerfile.app
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
FROM node:18 AS builder
ARG SENTRY_ORG
ARG SENTRY_PROJECT
ARG SENTRY_AUTH_TOKEN
ARG VITE_SENTRY_DSN
ARG VITE_SENTRY_ENVIRONMENT
ARG VITE_SENTRY_RELEASE
WORKDIR /app
RUN mkdir -p confiture-web-app/src/assets
COPY package.json yarn.lock CHANGELOG.md ROADMAP.md .
COPY confiture-web-app/package.json confiture-web-app/
RUN yarn install --frozen-lockfile --non-interactive --production=false
WORKDIR /app/confiture-web-app
COPY confiture-web-app/ .
RUN VITE_MATOMO_ENABLE=1 SENTRY_ORG=${SENTRY_ORG} SENTRY_PROJECT=${SENTRY_PROJECT} SENTRY_AUTH_TOKEN=${SENTRY_AUTH_TOKEN} VITE_SENTRY_DSN=${VITE_SENTRY_DSN} VITE_SENTRY_ENVIRONMENT=${VITE_SENTRY_ENVIRONMENT} VITE_SENTRY_RELEASE=${VITE_SENTRY_RELEASE} yarn build
FROM ghcr.io/disic/designgouv-confiture/nginx:1.22.1-r0 AS production
ARG VERSION=1.0
# nginx config
COPY confiture-web-app/config /tmp/config
# Web app files
COPY --from=builder /app/confiture-web-app/dist /data/confiture
RUN \
\
# version to avoid cache \
echo "version $VERSION" && \
\
# nginx config \
rm -rf /etc/nginx && \
mkdir /etc/nginx /etc/nginx_user && \
tar -C /tmp/config/config_nginx -cf - . | tar -C /etc/nginx -xf - && \
tar -C /tmp/config/config_nginx_user -cf - . | tar -C /etc/nginx_user -xf - && \
rm -rf tmp/config && \
\
# set correct permissions \
chown -R root:root /etc/nginx && \
chown -R root:dinum_nginx /etc/nginx_user /data && \
chmod -R go= /etc/nginx && \
chmod -R g=rX,o= /etc/nginx_user /data && \
\
# cleanup \
find /var/cache/apk /tmp /var/tmp /run -mindepth 1 -delete -print