forked from claabs/epicgames-freegames-node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
53 lines (37 loc) · 1.07 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
########
# BASE
########
FROM node:12-alpine as base
WORKDIR /usr/app
########
# BUILD
########
FROM base as build
# Copy all source files
COPY package*.json tsconfig.json ./
COPY src/site/public/package*.json src/site/public/tsconfig.json ./src/site/public/
# Add dev deps
RUN npm ci && cd src/site/public && npm ci
# Copy source code
COPY src src
RUN npm run build
########
# DEPLOY
########
FROM base as deploy
VOLUME [ "/usr/app/config" ]
RUN apk add --no-cache \
jq \
tzdata
ENV NODE_ENV production
# Copy package.json for version number
COPY package*.json ./
COPY src/site/public/package*.json src/site/public/tsconfig.json ./src/site/public/
RUN npm ci --only=production && cd src/site/public && npm ci --only=production
# Steal compiled code from build image
COPY --from=build /usr/app/dist ./dist
COPY entrypoint.sh /usr/local/bin/docker-entrypoint.sh
# backwards compat (from https://success.docker.com/article/use-a-script-to-initialize-stateful-container-data)
RUN ln -s /usr/local/bin/docker-entrypoint.sh /
EXPOSE 3000
ENTRYPOINT ["docker-entrypoint.sh"]