From 81673a3fcc2d667c7a1a82ca7a9b0b248aea9e16 Mon Sep 17 00:00:00 2001 From: Tanguy Herbron Date: Sun, 18 Apr 2021 16:05:55 +0200 Subject: [PATCH] Change building and deploying procedure --- Dockerfile | 23 ++++------------------- docker-compose.yml | 10 +++++++--- 2 files changed, 11 insertions(+), 22 deletions(-) diff --git a/Dockerfile b/Dockerfile index bda5962..a2b7a2d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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;"] diff --git a/docker-compose.yml b/docker-compose.yml index 5f1eedf..a721842 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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