Created
March 27, 2025 01:11
-
-
Save SumonMSelim/d23427020f33a614f6ed89d437775cbd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ######################### | |
# Frontend service | |
# ######################### | |
# node:22-alpine version should be in sync with compatible react,next,react-dom verions in frontend/package.json | |
# Stage 1: Build | |
FROM node:22-alpine AS insights-frontend-builder | |
WORKDIR /app | |
# install frontend dependencies before copying the frontend code | |
# into the container so we get docker cache benefits | |
COPY frontend/package*.json ./ | |
RUN npm install | |
COPY frontend/ ./ | |
RUN npm run build | |
# Stage 2: Production Image | |
FROM node:22-alpine AS insights-web | |
WORKDIR /app | |
COPY --link --from=insights-frontend-builder app/package*.json ./ | |
COPY --link --from=insights-frontend-builder /app/next.config.mjs ./ | |
COPY --link --from=insights-frontend-builder /app/.next/standalone ./ | |
COPY --link --from=insights-frontend-builder /app/.next/standalone/server.js ./server.js | |
COPY --link --from=insights-frontend-builder /app/.next/static ./.next/static | |
COPY --link --from=insights-frontend-builder /app/public ./public | |
ENV NODE_ENV=production | |
ENV HOSTNAME=0.0.0.0 | |
EXPOSE 3000 | |
CMD ["node", "server.js"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment