darkwire.io/Dockerfile
2024-01-01 15:41:08 -06:00

34 lines
922 B
Docker

# 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"]