Skip to content

Commit da1d815

Browse files
committed
feat(infra)!: revamp docker file
1 parent 098da80 commit da1d815

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

infra/Dockerfile.prod

+19-10
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,29 @@
1-
# Stage 1: Build stage
2-
FROM node:18.20-alpine AS builder
1+
ARG NODE_VERSION=22.7
32

4-
WORKDIR /app
3+
# Build stage
4+
FROM node:${NODE_VERSION}-slim AS build
5+
6+
WORKDIR /build-space
7+
8+
COPY ./package.json /build-space/
9+
COPY ./yarn.lock /build-space/
510

6-
COPY package.json yarn.lock ./
711
RUN yarn install
812

9-
COPY . .
13+
COPY . ./
1014

11-
# Stage 2: Production stage
12-
FROM node:18.20-alpine
15+
RUN yarn build
1316

17+
# Production stage
18+
FROM node:${NODE_VERSION}-alpine
1419
WORKDIR /app
1520

16-
COPY --from=builder /app /app
21+
COPY --from=build /build-space/.output ./
22+
23+
ENV HOST=0.0.0.0
24+
ENV NODE_ENV=production
25+
ENV PORT=80
1726

18-
EXPOSE 3001
27+
EXPOSE 80
1928

20-
CMD ["sh", "-c", "yarn migration:apply && yarn dev"]
29+
CMD ["node", "/app/server/index.mjs"]

0 commit comments

Comments
 (0)