-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
40 lines (28 loc) · 993 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
# Stage 1: install the dependencies
FROM node:12-alpine as dependencyInstaller
# Install build toolchain, install node deps and compile native add-ons
RUN apk add --no-cache --virtual builds-deps build-base python
# Specify the "working directory" for the rest of the stage
WORKDIR /app
# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json ./
RUN npm ci
# Stage 2: run the server
FROM node:12-alpine
## Add metadata
LABEL version=1.0
LABEL maintainer="Abdelrahman Soliman"
## Specify the "working directory" for the rest of the stage
WORKDIR /app
## Copy built node modules and binaries without including the toolchain
COPY --from=dependencyInstaller /app/node_modules node_modules
## Add application code
COPY . .
# Transpile TypeScript into JavaScript
RUN npm run build
## Allows port 3000 to be publicly available
EXPOSE 3000
## Run the server
CMD ["npm", "run", "start:prod"]