diff --git a/distribution_fe/.dockerignore b/distribution_fe/.dockerignore new file mode 100644 index 0000000..81615a8 --- /dev/null +++ b/distribution_fe/.dockerignore @@ -0,0 +1,5 @@ +node_modules +.next +.git +.gitignore +*.md diff --git a/distribution_fe/Dockerfile b/distribution_fe/Dockerfile new file mode 100644 index 0000000..64817f2 --- /dev/null +++ b/distribution_fe/Dockerfile @@ -0,0 +1,22 @@ +FROM node:20-alpine AS deps +WORKDIR /app +COPY package.json package-lock.json* ./ +RUN npm ci + +FROM node:20-alpine AS builder +WORKDIR /app +COPY --from=deps /app/node_modules ./node_modules +COPY . . +RUN npm run build + +FROM node:20-alpine AS runner +WORKDIR /app +ENV NODE_ENV=production +RUN addgroup --system --gid 1001 nodejs && adduser --system --uid 1001 nextjs +COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ +COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static +COPY --from=builder --chown=nextjs:nodejs /app/public ./public +USER nextjs +EXPOSE 3000 +ENV PORT=3000 +CMD ["node", "server.js"] diff --git a/distribution_fe/next.config.ts b/distribution_fe/next.config.ts index 3b32baf..f994a0b 100644 --- a/distribution_fe/next.config.ts +++ b/distribution_fe/next.config.ts @@ -6,6 +6,7 @@ const nextConfig: NextConfig = { // with "Cannot read properties of undefined (reading 'appendChild')" on any page using // LocationPicker. Production builds never double-invoke, so this only affects local dev. reactStrictMode: false, + output: "standalone", } export default nextConfig