This commit is contained in:
Philipp Dormann 2021-05-22 18:56:45 +02:00
parent 8965d60516
commit 1d634c0c53
5 changed files with 7 additions and 63 deletions

View file

@ -1,28 +1,9 @@
FROM node:16.2.0-alpine3.13 AS build
WORKDIR /build
RUN yarn config set --home enableTelemetry 0
COPY package.json yarn.lock /build/
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 package.json /build/
RUN yarn
COPY . /build
RUN yarn next telemetry disable
RUN yarn build
# Production image
FROM node:16.2.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/yarn.lock /build/package.json ./
COPY --from=build /build/.next ./.next
COPY --from=build /build/public ./public
RUN yarn prisma migrate dev
CMD ["yarn", "start"]