-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
48 lines (31 loc) · 1.06 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
# ---- Build ----
FROM --platform=linux/amd64 groupclaes/npm AS build
# change the working directory to new exclusive app folder
WORKDIR /usr/src/app
# copy project file
COPY ./ ./
# install node packages
RUN npm install
# create esbuild package
RUN esbuild ./index.ts --bundle --platform=node --minify --packages=external --external:'./config' --outfile=index.min.js
# ---- Deps ----
FROM --platform=linux/amd64 groupclaes/npm AS depedencies
# change the working directory to new exclusive app folder
WORKDIR /usr/src/app
# copy package file
COPY package.json ./
# install node packages
RUN npm install
# --- release ---
FROM --platform=linux/amd64 groupclaes/node AS release
# set current user to node
USER node
# change the working directory to new exclusive app folder
WORKDIR /usr/src/app
# copy dependencies
COPY --chown=node:node --from=depedencies /usr/src/app ./
# copy project file
COPY --chown=node:node --from=build /usr/src/app/index.min.js ./
COPY --chown=node:node src/assets/ ./assets/
# command to run when intantiate an image
CMD ["node","index.min.js"]