-
Notifications
You must be signed in to change notification settings - Fork 11
/
Dockerfile.Historia
45 lines (35 loc) · 1.17 KB
/
Dockerfile.Historia
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
43
44
45
FROM node:20-bookworm-slim AS base
##################################
# 1. Build the app
##################################
FROM base AS builder
# Give node user ownership of the app directory
WORKDIR /app
USER root
RUN chown -R node:node /app
USER node
# Install dependencies
COPY --chown=node:node package.json /app
COPY --chown=node:node package-lock.json /app
COPY --chown=node:node apps/historia/package.json /app/apps/historia/package.json
COPY --chown=node:node apps/historia/tsconfig.json /app/apps/historia/tsconfig.json
RUN npm ci
## Build the app
WORKDIR /app/apps/historia
COPY --chown=node:node apps/historia/src/ /app/apps/historia/src/
RUN npm run build:historia
##################################
# 2. Run the app
##################################
FROM base AS runtime
USER node
ENV NODE_ENV=production
ENV PAYLOAD_CONFIG_PATH=/app/dist/payload.config.js
WORKDIR /app
COPY --chown=node:node apps/historia/package.json /app
COPY --chown=node:node package-lock.json /app
RUN npm ci
COPY --chown=node:node --from=builder /app/apps/historia/dist /app/dist
COPY --chown=node:node --from=builder /app/apps/historia/build /app/build
EXPOSE 3300
CMD ["node", "/app/dist/server.js"]