-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (27 loc) · 980 Bytes
/
Dockerfile
File metadata and controls
40 lines (27 loc) · 980 Bytes
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
###############################################################
FROM node:18 as builder
COPY package.json yarn.lock ./
RUN yarn
COPY src ./src
COPY tsconfig.json tsconfig.json
RUN yarn
RUN yarn build
###############################################################
FROM golang:1.18 as nodeprune
# Build node-prune from source
RUN go install github.com/tj/node-prune@latest
###############################################################
FROM node:18 as dependencies
ENV NODE_ENV production
COPY package.json yarn.lock ./
RUN yarn --production
# Copy node-prune binary built from source
COPY --from=nodeprune /go/bin/node-prune /usr/local/bin/node-prune
RUN node-prune
###############################################################
FROM node:18-alpine as runtime
ENV NODE_ENV production
COPY package.json /action/package.json
COPY --from=builder dist /action/dist
COPY --from=dependencies node_modules /action/node_modules
ENTRYPOINT ["node", "/action/dist/index.js"]