-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
59 lines (39 loc) · 1.11 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
# --------------- BUILD STAGE --------------- #
FROM node:lts as build-stage
# Move to root directory
WORKDIR /apps
# Copy all necessary files
COPY ./Apps/Server ./Server
COPY ./Apps/Client ./Client
# Move to client app directory
WORKDIR /apps/Client
# Install packages
RUN npm install
# Build the app
RUN npm run build
# Move to server app directory
WORKDIR /apps/Server
# Install packages
RUN npm install
# Build the app
RUN npm run build
# --------------- RUN STAGE --------------- #
FROM node:lts-alpine as run-stage
# Move to root directory of app
WORKDIR /app
# Only copy compiled files
COPY --from=build-stage ./apps/Server/build ./
# Copy client app to static directory of server app
COPY --from=build-stage ./apps/Client/build ./client
# Only install production-related packages
RUN npm install --omit=dev
# Copy environment variables
COPY ./Apps/Server/.env.production ./.env.production
# Set the STOPSIGNAL
STOPSIGNAL SIGTERM
# Expose necessary port to talk with service
EXPOSE 8000
# Set environment variables
ENV ENV=production
# Define command to run when launching the image
CMD ["node", "./src/index.js"]