fix: 优化 docker 部署

This commit is contained in:
Clansty 2022-03-05 21:04:34 +08:00
parent b6b9cda114
commit b9bf2a12ba
No known key found for this signature in database
GPG Key ID: 05F8479BA63A8E92
1 changed files with 18 additions and 7 deletions

View File

@ -2,24 +2,35 @@ FROM jrottenberg/ffmpeg:4.1-alpine AS ffmpeg
FROM ghcr.io/clansty/tgs-to-gif:latest AS tgs
FROM node:17-alpine AS build
FROM node:17-alpine AS deps
WORKDIR /app
COPY package.json yarn.lock .yarnrc.yml ./
COPY .yarn/ ./.yarn/
RUN apk add --no-cache --virtual .build-deps alpine-sdk python3 &&\
yarn install &&\
apk del .build-deps
RUN apk add --no-cache alpine-sdk python3 &&\
yarn install
FROM node:17-alpine AS build
WORKDIR /app
COPY --from=deps /app/ /app/
COPY tsconfig.json ./
COPY src/ ./src/
RUN yarn build
FROM node:17-alpine
WORKDIR /app
COPY --from=ffmpeg / /
COPY --from=tgs / /
COPY --from=build /app/ /app/
COPY --from=deps /app/ /app/
COPY prisma/ ./prisma/
COPY build/ ./build/
COPY --from=build /app/build/ /app/build/
CMD [ "yarn", "start" ]