-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.dockerignore
36 lines (25 loc) · 1.03 KB
/
server.dockerignore
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
# The instructions for the first stage
FROM node:14.15.3-alpine as builder
# set to production to run build
#ARG NODE_ENV=development
# set working directory
WORKDIR /app
# Could copy over package.jsons first to optimize but local projects would make that a pain in the butt
COPY ./ ./
WORKDIR /app/server
# NPM behave differently if you use root user (not running prepare etc.)
# --unsafe-perm becomes required in multiple places
# https://stackoverflow.com/a/19132229
# user is bob because... bob the builder...
RUN adduser -S bob && chown -R bob ..
USER bob
# npm run build is part of npm install through prepare script
# tgz file has to be deleted after npm install otherwise that will fail
RUN npm install && rm -r rederly-course-export-*.tgz tsconfig.json src && npm prune --production
# The instructions for second stage
FROM node:14.15.3-alpine
#WORKDIR /app
COPY --from=builder /app/server ./rederly-course-export-server
# COPY --from=builder /app/.env ./rederly/
WORKDIR /rederly-course-export-server
CMD npm run run:build server