-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
48 lines (35 loc) · 1.21 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
# Building phase
FROM node:9 as builder
LABEL description="Landingpage for 'beat the traffic'"
LABEL project="lab-beatthetraffic"
LABEL maintainer="[email protected]"
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install --only=production
# RUN npm audit fix
COPY . .
#Example: URL_PREFIX=/project/beatthetraffic
ARG URL_PREFIX=""
ENV URL_PREFIX $URL_PREFIX
#Example: ROOT_URL=beatthetraffic.moovellab.com
ARG ROOT_URL=""
ENV ROOT_URL $ROOT_URL
RUN npm run now-build
# Production phase
FROM node:9
WORKDIR /usr/src/app
COPY --from=builder /usr/src/app/.next /usr/src/app/.next
COPY --from=builder /usr/src/app/node_modules /usr/src/app/node_modules
COPY --from=builder /usr/src/app/server /usr/src/app/server
COPY --from=builder /usr/src/app/out /usr/src/app/out
COPY --from=builder /usr/src/app/package.json /usr/src/app/
COPY --from=builder /usr/src/app/gameconfig.json /usr/src/app/
EXPOSE 80
# For beat the traffic , need to specify env var at both build and runtime
#Example: /project/beatthetraffic
ARG URL_PREFIX=""
ENV URL_PREFIX $URL_PREFIX
#Example: beatthetraffic.moovellab.com
ARG ROOT_URL=""
ENV ROOT_URL $ROOT_URL
CMD [ "npm", "run", "aws-start" ]