mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-09-12 13:10:05 +00:00
![google-labs-jules[bot]](/assets/img/avatar_default.png)
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.
33 lines
741 B
Docker
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"]
|