Change building and deploying procedure

This commit is contained in:
Tanguy Herbron 2021-04-18 16:05:55 +02:00
parent 33e90e37b3
commit 81673a3fcc
2 changed files with 11 additions and 22 deletions

View File

@ -11,23 +11,8 @@ COPY . .
COPY --from=deps /app/node_modules ./node_modules
RUN yarn build
FROM node:alpine AS runner
WORKDIR /app
FROM nginx AS runner
COPY --from=builder /app/out /usr/share/nginx/html
ENV NODE_ENV production
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 addgroup -g 1001 -S nodejs
RUN adduser -S nextjs -u 1001
RUN chown -R nextjs:nodejs /app/.next
USER nextjs
EXPOSE 3000
RUN npx next telemetry disable
CMD ["yarn", "start"]
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

View File

@ -2,8 +2,12 @@ version: "3.2"
services:
website:
build: .
container_name: therbron.com
build:
context: .
dockerfile: Dockerfile
container_name: "therbron.com"
ports:
- 3000:3000
- 8000:80
volumes:
- ./out:/usr/share/nginx/html
restart: unless-stopped