Update Dockerfile

This commit is contained in:
DefectingCat
2021-11-19 16:35:19 +08:00
parent f08aa4f678
commit 45a9d436bb

View File

@ -22,6 +22,17 @@ RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
&& yarn config set registry https://registry.npm.taobao.org \
&& yarn build && yarn install --production --ignore-scripts --prefer-offline
# e2e test
FROM cypress/base AS tester
WORKDIR /app
COPY --from=builder /app/next.config.js ./
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./package.json
RUN yarn e2e:headless
# Production image, copy all the files and run next
FROM node:lts-alpine AS runner
WORKDIR /app
@ -32,7 +43,7 @@ RUN addgroup -g 1001 -S nodejs
RUN adduser -S nextjs -u 1001
# You only need to copy next.config.js if you are NOT using the default configuration
# COPY --from=builder /app/next.config.js ./
COPY --from=builder /app/next.config.js ./
COPY --from=builder /app/public ./public
COPY --from=builder --chown=nextjs:nodejs /app/.next ./.next
COPY --from=builder /app/node_modules ./node_modules