Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dashboard Dockerfile #422

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 36 additions & 7 deletions dashboard/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,46 @@
FROM node:21 as build
# Derived from
# https://github.com/vercel/next.js/blob/4b9ef1eb23f9d247321c9368d08c2398b6ec8169/examples/with-docker/Dockerfile
FROM node:21-alpine AS base

FROM base AS deps
WORKDIR /app

ENV NODE_ENV production

COPY package*.json /app/
RUN npm ci --legacy-peer-deps

COPY . ./
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .

RUN npm run build

FROM nginx
FROM base AS runner
WORKDIR /app

ENV NODE_ENV production

RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs

COPY --from=builder /app/public ./public

# Set the correct permission for prerender cache
RUN mkdir .next
RUN chown nextjs:nodejs .next

# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static

USER nextjs

EXPOSE 3001

WORKDIR /usr/share/nginx/html
ENV PORT=3001

COPY --from=build /app/out/ ./
# server.js is created by next build from the standalone output
# https://nextjs.org/docs/pages/api-reference/next-config-js/output
ENV HOSTNAME="0.0.0.0"
CMD ["node", "server.js"]
1 change: 1 addition & 0 deletions dashboard/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ module.exports = {
},
];
},
output: 'standalone'
};