-
Notifications
You must be signed in to change notification settings - Fork 18
/
Dockerfile
42 lines (30 loc) · 1.15 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
ARG node_version=18.18
ARG node_image=node:${node_version}
FROM $node_image AS builder
ENV NEXT_TELEMETRY_DISABLED=1 \
NODE_ENV=development
WORKDIR /app
COPY . /app/
RUN yarn --network-timeout 300000; \
NODE_ENV=production yarn build
WORKDIR /app/backend
RUN yarn --network-timeout 300000; \
NODE_ENV=production yarn build
FROM alpine AS intermediate
COPY ./docker-assets /app/docker-assets/
COPY --from=builder /app/backend/package.json /app/backend/package.json
COPY --from=builder /app/backend/node_modules /app/backend/node_modules
COPY --from=builder /app/backend/dist /app/backend/dist
COPY --from=builder /app/siren.js /app/package.json /app/
COPY --from=builder /app/node_modules /app/node_modules
COPY --from=builder /app/public /app/public
COPY --from=builder /app/.next /app/.next
FROM $node_image AS production
ENV NODE_ENV=production
RUN npm install --global pm2; \
apt update; \
apt install -y nginx openssl curl ncat
RUN rm /etc/nginx/sites-enabled/default; \
ln -s /app/docker-assets/siren-http.conf /etc/nginx/conf.d/siren-http.conf
COPY --from=intermediate /app /app/
ENTRYPOINT ["/app/docker-assets/docker-entrypoint.sh"]