This repository has been archived by the owner on Feb 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
93 lines (69 loc) · 2.1 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
FROM node:19-bullseye AS orm_build
WORKDIR /build/orm
# Dependencies
COPY orm/package*.json ./
RUN npm install
# Generate artifacts
COPY orm ./
RUN npx prisma generate
FROM node:19-bullseye AS api_build
WORKDIR /build/api
# Dependencies
COPY api/package*.json ./
RUN npm install
# Retrieve artifacts
COPY --from=orm_build /build/orm/package*.json /build/orm/
COPY --from=orm_build /build/orm/dist/ /build/orm/dist/
# Generate artifacts
COPY api ./
RUN npm run build
FROM node:19-bullseye AS api_query_build
WORKDIR /build/api_query
# Dependencies
COPY api_query/package*.json ./
RUN npm install
# Retrieve artifacts
COPY --from=orm_build /build/orm/package*.json /build/orm/
COPY --from=orm_build /build/orm/dist/ /build/orm/dist/
# Generate artifacts
COPY api_query ./
RUN npm run build
FROM node:19-bullseye AS api_production
WORKDIR /build/api
# Dependencies
COPY --from=api_build /build/api/package*.json ./
RUN npm install --omit=dev
# Retrieve artifacts
COPY --from=api_build /build/orm/package*.json /build/orm/
COPY --from=api_build /build/orm/dist/ /build/orm/dist/
COPY --from=api_build /build/api/dist/ /build/api/dist/src
# Initialize server
EXPOSE 8080
ENTRYPOINT npm run start
FROM node:19-bullseye AS web_build
ARG VUE_APP_API_SERVER_ADDRESS
ARG VUE_APP_IMGPROXY_SERVER_ADDRESS
WORKDIR /build/web
# Dependencies
COPY web/package*.json ./
RUN npm install --omit=optional
# Retrieve artifacts
COPY --from=orm_build /build/orm/package*.json /build/orm/
COPY --from=orm_build /build/orm/dist/ /build/orm/dist/
COPY --from=api_query_build /build/api_query /build/api_query/
COPY --from=api_query_build /build/api_query/dist/ /build/api_query/dist/
# https://stackoverflow.com/questions/51115856/docker-failed-to-export-image-failed-to-create-image-failed-to-get-layer
RUN true
# Generate artifacts
COPY web ./
RUN true
RUN npm run build
FROM nginx:alpine as web_production
WORKDIR /usr/share/nginx/html
# Remove default assets
RUN rm -rf ./*
# Copy artifacts
COPY --from=web_build /build/web/dist ./
# Copy configuration file
COPY server/nginx.conf /etc/nginx/nginx.conf
ENTRYPOINT ["nginx", "-g", "daemon off;"]