mirror of
https://github.com/umami-software/umami.git
synced 2026-02-19 03:55:37 +01:00
🐳 Dockerfile Multistage
This commit is contained in:
parent
8828d46a8a
commit
6ac86ebfe5
1 changed files with 22 additions and 2 deletions
24
Dockerfile
24
Dockerfile
|
|
@ -2,8 +2,28 @@ FROM node:14.17.0-alpine3.13 AS build
|
||||||
WORKDIR /build
|
WORKDIR /build
|
||||||
RUN yarn config set --home enableTelemetry 0
|
RUN yarn config set --home enableTelemetry 0
|
||||||
COPY package.json /build/
|
COPY package.json /build/
|
||||||
RUN yarn
|
RUN yarn --production --frozen-lockfile
|
||||||
|
# Cache these modules for production
|
||||||
|
RUN cp -R node_modules/ prod_node_modules/
|
||||||
|
# Install development dependencies
|
||||||
|
RUN yarn --frozen-lockfile
|
||||||
COPY . /build
|
COPY . /build
|
||||||
|
RUN yarn next telemetry disable
|
||||||
RUN yarn build
|
RUN yarn build
|
||||||
# RUN yarn prisma migrate dev
|
|
||||||
|
# Production image
|
||||||
|
FROM node:14.17.0-alpine3.13 AS production
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Copy cached dependencies
|
||||||
|
COPY --from=build /build/prod_node_modules ./node_modules
|
||||||
|
|
||||||
|
# Copy generated Prisma client
|
||||||
|
COPY --from=build /build/node_modules/.prisma/ ./node_modules/.prisma/
|
||||||
|
|
||||||
|
COPY --from=build /build/package.json ./
|
||||||
|
COPY --from=build /build/.next ./.next
|
||||||
|
COPY --from=build /build/public ./public
|
||||||
|
COPY prisma ./prisma
|
||||||
|
RUN yarn prisma migrate dev
|
||||||
CMD ["yarn", "start"]
|
CMD ["yarn", "start"]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue