-
Notifications
You must be signed in to change notification settings - Fork 1
/
Backend.Dockerfile
42 lines (35 loc) · 1.15 KB
/
Backend.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=20
ARG ALPINE_VERSION=3.19
FROM node:${NODE_VERSION} AS core-builder
WORKDIR app
COPY ./*.json ./
COPY ./core/ ./core/
RUN npm install -w core
RUN npm run build -w core
FROM node:${NODE_VERSION} AS builder
WORKDIR app
COPY ./*.json ./
COPY ./backend/ ./backend/
COPY --from=core-builder /app/core/build ./core/
COPY --from=core-builder /app/core/*.json ./core/
RUN npm install -w backend
RUN npm run build -w backend
FROM node:${NODE_VERSION} AS dependencies
WORKDIR app
COPY ./package* ./
COPY ./backend/package* ./backend/
COPY --from=core-builder /app/core/build ./core/
COPY --from=core-builder /app/core/*.json ./core/
RUN npm install --omit=dev -w backend
FROM node:${NODE_VERSION}-alpine${ALPINE_VERSION}
LABEL maintainer="DEFFERRARD Jeremy" \
description="Open source Tactical RPG - Backend Service" \
website="https://defferrard.dev/"
USER node
WORKDIR app
COPY --from=builder /app/backend/build ./
COPY ./backend/*.json ./
COPY --from=dependencies /app/node_modules/ ./node_modules/
COPY --from=core-builder /app/core/build/ ./node_modules/@defferrard/algoo-core/
EXPOSE 8080
CMD node index.js