-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
46 lines (31 loc) · 1.26 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
ARG RUN
FROM node:18-alpine as builderenv
WORKDIR /app
# some packages require a build step
RUN apk update && apk add wget
# build the app
COPY . /app
RUN yarn install --frozen-lockfile
RUN yarn build
# remove devDependencies, keep only used dependencies
RUN yarn install --prod --frozen-lockfile
########################## END OF BUILD STAGE ##########################
FROM node:18-alpine
RUN apk update && apk add --update wget && apk add --update tini
# NODE_ENV is used to configure some runtime options, like JSON logger
ENV NODE_ENV production
ARG COMMIT_HASH=local
ENV COMMIT_HASH=${COMMIT_HASH:-local}
ARG CURRENT_VERSION=Unknown
ENV CURRENT_VERSION=${CURRENT_VERSION:-Unknown}
WORKDIR /app
COPY --from=builderenv /app /app
RUN echo "" > /app/api/.env
RUN echo "" > /app/processor/.env
# Please _DO NOT_ use a custom ENTRYPOINT because it may prevent signals
# (i.e. SIGTERM) to reach the service
# Read more here: https://aws.amazon.com/blogs/containers/graceful-shutdowns-with-ecs/
# and: https://www.ctl.io/developers/blog/post/gracefully-stopping-docker-containers/
ENTRYPOINT ["tini", "--"]
# Run the program under Tini
CMD [ "/usr/local/bin/node", "--trace-warnings", "--abort-on-uncaught-exception", "--unhandled-rejections=strict", "dist/index.js" ]