forked from darkwire/darkwire.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
33 lines (25 loc) · 922 Bytes
/
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
# Stage 1: Build Stage
FROM node:alpine3.19 AS builder
WORKDIR /home/node
COPY --chown=node:node . .
RUN apk update \
&& apk add --no-cache bash \
&& chmod +x /home/node/start.sh \
&& npm install -g yarn@latest --force \
&& yarn install --flat --production --no-cache \
&& yarn build --no-cache \
&& rm -rf /home/node/node_modules \
&& yarn cache clean \
&& yarn autoclean --force
# Stage 2: Production Stage
FROM node:alpine3.19
WORKDIR /home/node
COPY --from=builder /home/node .
RUN apk add --no-cache curl nginx openssl && \
rm /etc/nginx/http.d/default.conf && \
mv /home/node/default.conf /etc/nginx/http.d/ && \
chmod +x /home/node/start.sh
STOPSIGNAL SIGINT
HEALTHCHECK --interval=30s --timeout=30s --start-period=10s --retries=3 \
CMD [ "curl", "-f", "http://localhost:3001", "||", "exit", "1" ]
CMD ["/home/node/start.sh"]