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 COPY --from=deps /app/node_modules ./node_modules
RUN yarn build RUN yarn build
FROM node:alpine AS runner FROM nginx AS runner
WORKDIR /app COPY --from=builder /app/out /usr/share/nginx/html
ENV NODE_ENV production EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
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"]

View File

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