37 lines
746 B
Plaintext
37 lines
746 B
Plaintext
# Stage 1: Build
|
|
FROM node:18-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
COPY package.json package-lock.json ./
|
|
RUN npm install --production
|
|
|
|
COPY . .
|
|
|
|
# Build-time environment variable
|
|
ARG NEXT_PUBLIC_API_URL=https://cmcbackend.rootxwire.com
|
|
ENV NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL
|
|
|
|
RUN npm run build
|
|
|
|
# Stage 2: Run
|
|
FROM node:18-alpine AS runner
|
|
|
|
WORKDIR /app
|
|
|
|
COPY --from=builder /app/package.json ./
|
|
COPY --from=builder /app/package-lock.json ./
|
|
COPY --from=builder /app/.next ./.next
|
|
COPY --from=builder /app/public ./public
|
|
COPY --from=builder /app/next.config.js ./next.config.js
|
|
|
|
RUN npm install --production
|
|
|
|
EXPOSE 3000
|
|
|
|
ENV NODE_ENV=production
|
|
ENV NEXT_PUBLIC_API_URL=https://cmcbackend.rootxwire.com
|
|
ENV HOST=0.0.0.0
|
|
|
|
CMD ["npm", "start"]
|