This repository was archived by the owner on Oct 16, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
60 lines (37 loc) · 1.42 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
49
50
51
52
53
54
55
56
57
58
59
60
FROM node:22.9.0-alpine AS base-image
WORKDIR /srv/app/
RUN corepack enable
################################################################################
FROM base-image AS development
COPY ./docker-entrypoint.sh /usr/local/bin/
VOLUME /srv/.pnpm-store
VOLUME /srv/app
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["pnpm", "run", "dev"]
################################################################################
FROM base-image AS prepare
COPY ./pnpm-lock.yaml ./
RUN pnpm fetch
COPY ./ ./
RUN pnpm install --offline
################################################################################
FROM prepare AS lint
RUN pnpm run lint
################################################################################
FROM prepare AS test
RUN pnpm run test --run
################################################################################
FROM prepare AS build
ENV NODE_ENV=production
RUN pnpm run build \
# Discard development dependencies after building.
&& pnpm install --offline --ignore-scripts
################################################################################
FROM prepare AS collect
COPY --from=build /srv/app/ /srv/app/
COPY --from=lint /srv/app/package.json /tmp/package.json
COPY --from=test /srv/app/package.json /tmp/package.json
################################################################################
FROM collect AS production
ENV NODE_ENV=production
CMD ["pnpm", "run", "start"]