muse/Dockerfile

49 lines
987 B
Docker
Raw Permalink Normal View History

2022-08-27 04:14:07 +02:00
FROM node:18.7.0-slim AS base
2020-03-17 18:30:27 +01:00
2022-01-05 21:47:02 +01:00
# Install ffmpeg
RUN apt-get update && \
apt-get install -y ffmpeg tini libssl-dev ca-certificates git && \
rm -rf /var/lib/apt/lists/*
2020-03-17 18:30:27 +01:00
2022-03-26 17:33:56 +01:00
# Install dependencies
FROM base AS dependencies
2020-03-17 18:30:27 +01:00
WORKDIR /usr/app
2021-01-07 18:54:32 +01:00
COPY package.json .
COPY yarn.lock .
2020-03-17 18:30:27 +01:00
RUN yarn install --prod
2023-12-22 01:30:25 +01:00
RUN cp -R node_modules /usr/app/prod_node_modules
RUN yarn install
FROM dependencies AS builder
COPY . .
# Run tsc build
RUN yarn prisma generate
RUN yarn build
2020-11-18 21:14:16 +01:00
2022-03-26 17:33:56 +01:00
# Only keep what's necessary to run
FROM base AS runner
2022-03-26 17:33:56 +01:00
WORKDIR /usr/app
2023-12-22 01:30:25 +01:00
COPY --from=builder /usr/app/dist ./dist
COPY --from=dependencies /usr/app/prod_node_modules node_modules
COPY --from=builder /usr/app/node_modules/.prisma/client ./node_modules/.prisma/client
2020-03-17 18:30:27 +01:00
COPY . .
ARG COMMIT_HASH=unknown
2022-03-26 22:51:34 +01:00
ARG BUILD_DATE=unknown
2020-03-17 18:30:27 +01:00
ENV DATA_DIR /data
ENV NODE_ENV production
ENV COMMIT_HASH $COMMIT_HASH
2022-03-26 22:51:34 +01:00
ENV BUILD_DATE $BUILD_DATE
2020-03-17 18:30:27 +01:00
2023-12-22 01:30:25 +01:00
CMD ["tini", "--", "node", "--enable-source-maps", "dist/scripts/migrate-and-start.js"]