-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
41 lines (36 loc) · 1.15 KB
/
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
FROM node:22 AS frontend-build
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
WORKDIR /app/frontend
COPY ./package.json ./pnpm-lock.yaml ./
COPY ./tsconfig.json ./tsconfig.app.json ./tsconfig.node.json ./
COPY ./vite.config.ts ./
COPY ./src ./src
COPY ./public ./public
COPY index.html .env.production ./
RUN pnpm install
RUN pnpm build
FROM node:22 AS backend-build
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
WORKDIR /app/backend
COPY ./server/package.json ./server/pnpm-lock.yaml ./
COPY ./server/tsconfig.json ./
COPY ./server/src ./src
COPY ./server/.env ./
RUN pnpm install
RUN pnpm build
EXPOSE 5000
FROM docker.io/nginx:latest AS production-stage
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
RUN apt-get update && apt-get install -y nodejs
RUN mkdir /app
COPY --from=frontend-build /app/frontend/dist /app/frontend
COPY --from=backend-build /app/backend/dist /app/backend
COPY --from=backend-build /app/backend/node_modules /app/backend/node_modules
COPY nginx.conf /etc/nginx/nginx.conf
COPY scripts/production.sh /app/production.sh
RUN chmod +x /app/production.sh
ENTRYPOINT ["/app/production.sh"]