diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..f58f3de --- /dev/null +++ b/.dockerignore @@ -0,0 +1,10 @@ +.git +.gitignore +node_modules +.next +.env* +!.env.example +README.md +Dockerfile +.dockerignore +docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e2f2d8c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,35 @@ +FROM node:20-alpine AS base +RUN apk add --no-cache libc6-compat + +FROM base AS deps +WORKDIR /app +COPY package.json yarn.lock* ./ +RUN npm install --legacy-peer-deps + +FROM base AS builder +WORKDIR /app +COPY --from=deps /app/node_modules ./node_modules +COPY . . +ENV NEXT_TELEMETRY_DISABLED=1 +RUN npm run build + +FROM base AS runner +WORKDIR /app +ENV NODE_ENV=production +ENV NEXT_TELEMETRY_DISABLED=1 + +RUN addgroup --system --gid 1001 nodejs +RUN adduser --system --uid 1001 nextjs + +COPY --from=builder /app/public ./public +COPY --from=builder --chown=nextjs:nodejs /app/.next ./.next +COPY --from=builder /app/node_modules ./node_modules +COPY --from=builder /app/package.json ./package.json +COPY --from=builder /app/next.config.mjs ./next.config.mjs + +USER nextjs +EXPOSE 3000 +ENV PORT=3000 +ENV HOSTNAME=0.0.0.0 + +CMD ["node_modules/.bin/next", "start"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..cb10e90 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,6 @@ +services: + removerized: + build: . + ports: + - "3000:3000" + restart: unless-stopped