-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
43 lines (29 loc) · 903 Bytes
/
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
ARG NODE_VER=16-alpine
ARG SERVICE=trellisfw/trellis-signer
FROM node:$NODE_VER AS install
ARG SERVICE
WORKDIR /$SERVICE
COPY ./.yarn /$SERVICE/.yarn
COPY ./package.json ./yarn.lock ./.yarnrc.yml /$SERVICE/
RUN yarn workspaces focus --all --production
FROM install AS build
ARG SERVICE
# Install dev deps too
RUN yarn install --immutable
COPY . /$SERVICE/
# Build code and remove dev deps
RUN yarn build --verbose && rm -rfv .yarn .pnp*
FROM node:$NODE_VER AS production
ARG SERVICE
# Install needed packages
RUN apk add --no-cache \
dumb-init
# Do not run service as root
USER node
WORKDIR /$SERVICE
COPY --from=install /$SERVICE/ /$SERVICE/
COPY --from=build /$SERVICE/ /$SERVICE/
# Launch entrypoint with dumb-init
# Remap SIGTERM to SIGINT https://github.com/Yelp/dumb-init#signal-rewriting
ENTRYPOINT ["/usr/bin/dumb-init", "--rewrite", "15:2", "--", "yarn", "run"]
CMD ["start"]