forked from utmgdsc/UBoard
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (30 loc) · 1.09 KB
/
Dockerfile
File metadata and controls
40 lines (30 loc) · 1.09 KB
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
# => Build server
FROM node:16-alpine as server_builder
WORKDIR /app/server
COPY server .
RUN yarn install && yarn run build
# => Build client
FROM node:16-alpine as client_builder
WORKDIR /app/client
COPY client .
RUN yarn install --production
COPY --from=server_builder /app/server/build/models /app/client/node_modules/models
COPY --from=server_builder /app/server/build/types/models /app/client/node_modules/@types/models
RUN yarn run build
# => Run container
FROM nginx:1.20-alpine as base
# Default port exposure
EXPOSE 80
# Add nodejs
RUN apk add --update nodejs
RUN apk add --update sqlite
# Nginx config
COPY nginx/nginx.conf /etc/nginx/nginx.conf
COPY nginx/conf.d/default.conf.template /etc/nginx/conf.d/default.conf.template
# Static build
WORKDIR /app
COPY --from=client_builder /app/client/build/. /usr/share/nginx/html/.
COPY --from=server_builder /app/server/ server
COPY nginx/html/404.html /usr/share/nginx/html/404.html
# Start Nginx server
CMD /bin/sh -c "envsubst '\$PORT' < /etc/nginx/conf.d/default.conf.template > /etc/nginx/conf.d/default.conf" && nginx && node server/build/server.js