forked from JensForstmann/tmt2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
37 lines (35 loc) · 1.09 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
FROM node:18-alpine AS BACKEND_BUILD_IMAGE
WORKDIR /app/backend
COPY backend/package-lock.json .
COPY backend/package.json .
RUN npm install
COPY common ../common
COPY backend/src src
COPY backend/tsconfig.json .
COPY backend/tsoa.json .
RUN npm run build
RUN npm prune --production
FROM node:18-alpine AS FRONTEND_BUILD_IMAGE
WORKDIR /app/frontend
COPY frontend/package-lock.json .
COPY frontend/package.json .
RUN npm install
COPY common ../common
COPY frontend/src src
COPY frontend/index.html .
COPY frontend/postcss.config.js .
COPY frontend/tailwind.config.js .
COPY frontend/tsconfig.json .
COPY frontend/vite.config.ts .
RUN npm run build
FROM node:18-alpine
COPY --from=BACKEND_BUILD_IMAGE /app/backend/package.json /app/backend/swagger.json /app/backend/
COPY --from=BACKEND_BUILD_IMAGE /app/backend/dist /app/backend/dist
COPY --from=BACKEND_BUILD_IMAGE /app/backend/node_modules /app/backend/node_modules
COPY --from=FRONTEND_BUILD_IMAGE /app/frontend/dist /app/frontend/dist
VOLUME /app/backend/storage
EXPOSE 8080
ARG COMMIT_SHA
ENV COMMIT_SHA=${COMMIT_SHA}
WORKDIR /app/backend
CMD ["npm", "start"]