generated from helsingborg-stad/gdi-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
37 lines (30 loc) · 916 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
FROM node:18 as compiler
ARG GITHUB_ACCESS_TOKEN
WORKDIR /work
COPY . ./
COPY deploy.npmrc .npmrc
RUN yarn install && yarn build
FROM node:18 as git-rev
WORKDIR /work
COPY .git .git
RUN git rev-parse --short HEAD > git_revision.txt
FROM node:18-alpine as optimizer
ARG GITHUB_ACCESS_TOKEN
WORKDIR /work
COPY . ./
COPY deploy.npmrc .npmrc
RUN yarn install --production --ignore-optional --platform=linux --arch=x64
#FROM gcr.io/distroless/nodejs18-debian11
FROM node:18-alpine
EXPOSE 3000
ENV NODE_ENV=production
ENV PORT=3000
WORKDIR /usr/src/app
COPY --from=optimizer /work/node_modules ./node_modules
COPY --from=optimizer /work/package.json ./
COPY --from=compiler /work/dist ./dist
COPY --from=compiler /work/index.js ./
COPY --from=compiler /work/openapi.yml ./
COPY --from=git-rev /work/git_revision.txt ./
COPY --from=optimizer /work/docker-cmd-with-crond.sh ./
CMD ["sh", "docker-cmd-with-crond.sh"]