-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
48 lines (28 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
FROM node:18.20.4-alpine@sha256:02376a266c84acbf45bd19440e08e48b1c8b98037417334046029ab585de03e2 AS development
WORKDIR /srv/app/
COPY ./docker-entrypoint.sh /usr/local/bin/
RUN corepack enable
VOLUME /srv/.pnpm-store
VOLUME /srv/app
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["pnpm", "run", "dev"]
FROM node:18.20.4-alpine@sha256:02376a266c84acbf45bd19440e08e48b1c8b98037417334046029ab585de03e2 AS build
WORKDIR /srv/app/
COPY ./pnpm-lock.yaml ./
RUN corepack enable && \
pnpm fetch
COPY . .
RUN pnpm install --offline \
&& pnpm run lint \
&& pnpm run test --run
ENV NODE_ENV=production
# Discard development dependencies after building.
RUN pnpm run build \
&& pnpm install --offline --ignore-scripts
FROM node:18.20.4-alpine@sha256:02376a266c84acbf45bd19440e08e48b1c8b98037417334046029ab585de03e2 AS production
ENV NODE_ENV=production
WORKDIR /srv/app/
COPY --from=build /srv/app/dist/ /srv/app/dist/
COPY --from=build /srv/app/package.json /srv/app/package.json
COPY --from=build /srv/app/node_modules/ /srv/app/node_modules/
CMD ["node", "./dist/stomper.js"]