3x-ui/new-frontend/Dockerfile
google-labs-jules[bot] 471579f053 Debug: Add echo for NEXT_PUBLIC_API_BASE_URL in frontend Dockerfile
To verify the value of NEXT_PUBLIC_API_BASE_URL available during
the frontend build stage, this commit adds an echo command to the
`new-frontend/Dockerfile`.

This will print the variable's value to the build logs immediately
before the `npm run build` command is executed. This helps diagnose
issues with the API base URL not being correctly passed or utilized
by the Next.js application, leading to incorrect API calls.
2025-06-05 10:32:27 +00:00

33 lines
741 B
Docker

# Stage 1: Build the Next.js application
FROM node:20-alpine AS builder
WORKDIR /app
COPY package.json package-lock.json ./
RUN corepack enable
RUN npm install
COPY . .
ARG NEXT_PUBLIC_API_BASE_URL
ENV NEXT_PUBLIC_API_BASE_URL=$NEXT_PUBLIC_API_BASE_URL
RUN echo "NEXT_PUBLIC_API_BASE_URL in Dockerfile build stage is: [$NEXT_PUBLIC_API_BASE_URL]"
RUN npm run build
# Stage 2: Production environment
FROM node:20-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/public ./public
COPY --from=builder /app/package.json ./package.json
COPY --from=builder /app/package-lock.json ./package-lock.json
RUN corepack enable
RUN npm install
EXPOSE 3000
CMD ["npm", "start"]