-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
49 lines (32 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
# ---- 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 esbuild globaly
RUN npm install esbuild -g
# install node packages
RUN npm install
# create esbuild package
RUN esbuild ./src/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 ./
# command to run when intantiate an image
CMD ["node","index.min.js"]