-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
41 lines (29 loc) · 902 Bytes
/
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
# Decreased image size = Faster deploy. Master Node.
FROM node:current-slim AS base
# Create app directory
WORKDIR /usr/src/app
# This files won't be needed until later
COPY ["./database", "./database"]
# Cached Step = Faster image build
EXPOSE 3000
# Build the project before releasing
FROM node:current-slim AS build
# Switch towards a safe directory
WORKDIR /usr/src/temp
# Copy needed files for building
COPY ["./LICENSE", "./"]
COPY ["./public", "./public"]
COPY ["./package.json", "yarn.lock", "./"]
COPY ["./src", "./src"]
# Auto build the project
RUN npm install && npm install yarn && yarn build
# Use the Master Node for releasing
FROM base AS release
WORKDIR /usr/src/app
# Set the production context files
COPY ["./context/", "./"]
# Install production dependencies
RUN ["npm", "install"]
# Copy built project
COPY --from=build /usr/src/temp/build ./build
CMD [ "npm", "start" ]