use multistage docker image build
This commit is contained in:
parent
dd89fb0101
commit
c3319fafe1
2 changed files with 17 additions and 10 deletions
15
Dockerfile
15
Dockerfile
|
|
@ -1,5 +1,5 @@
|
||||||
FROM node:20-alpine
|
FROM node:22-alpine AS build
|
||||||
WORKDIR /app
|
WORKDIR /build
|
||||||
|
|
||||||
RUN apk add python3 make g++ && \
|
RUN apk add python3 make g++ && \
|
||||||
corepack enable && \
|
corepack enable && \
|
||||||
|
|
@ -8,7 +8,14 @@ RUN apk add python3 make g++ && \
|
||||||
COPY package*.json pnpm*.yaml tsconfig.json ./
|
COPY package*.json pnpm*.yaml tsconfig.json ./
|
||||||
RUN pnpm install --frozen-lockfile
|
RUN pnpm install --frozen-lockfile
|
||||||
|
|
||||||
COPY src /app/src
|
COPY src ./src
|
||||||
RUN pnpm run build
|
RUN pnpm run build
|
||||||
|
RUN pnpm prune --prod
|
||||||
|
|
||||||
CMD [ "node", "/app/dist/main.js" ]
|
FROM node:22-alpine
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=build /build/package*.json ./
|
||||||
|
COPY --from=build /build/dist ./dist
|
||||||
|
COPY --from=build /build/node_modules ./node_modules
|
||||||
|
|
||||||
|
ENTRYPOINT [ "docker-entrypoint.sh", "node", "/app/dist/main.js" ]
|
||||||
|
|
|
||||||
12
pnpm-lock.yaml
generated
12
pnpm-lock.yaml
generated
|
|
@ -14,12 +14,6 @@ importers:
|
||||||
'@mtcute/node':
|
'@mtcute/node':
|
||||||
specifier: ^0.22.3
|
specifier: ^0.22.3
|
||||||
version: 0.22.3
|
version: 0.22.3
|
||||||
'@types/command-line-args':
|
|
||||||
specifier: ^5.2.3
|
|
||||||
version: 5.2.3
|
|
||||||
'@types/js-yaml':
|
|
||||||
specifier: ^4.0.9
|
|
||||||
version: 4.0.9
|
|
||||||
command-line-args:
|
command-line-args:
|
||||||
specifier: ^6.0.1
|
specifier: ^6.0.1
|
||||||
version: 6.0.1
|
version: 6.0.1
|
||||||
|
|
@ -36,6 +30,12 @@ importers:
|
||||||
'@antfu/eslint-config':
|
'@antfu/eslint-config':
|
||||||
specifier: ^4.11.0
|
specifier: ^4.11.0
|
||||||
version: 4.11.0(@typescript-eslint/utils@8.29.0(eslint@9.24.0)(typescript@5.8.3))(@vue/compiler-sfc@3.5.13)(eslint@9.24.0)(typescript@5.8.3)
|
version: 4.11.0(@typescript-eslint/utils@8.29.0(eslint@9.24.0)(typescript@5.8.3))(@vue/compiler-sfc@3.5.13)(eslint@9.24.0)(typescript@5.8.3)
|
||||||
|
'@types/command-line-args':
|
||||||
|
specifier: ^5.2.3
|
||||||
|
version: 5.2.3
|
||||||
|
'@types/js-yaml':
|
||||||
|
specifier: ^4.0.9
|
||||||
|
version: 4.0.9
|
||||||
'@types/node':
|
'@types/node':
|
||||||
specifier: ^22.14.0
|
specifier: ^22.14.0
|
||||||
version: 22.14.0
|
version: 22.14.0
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue