3a0e751834
Now it works with editing only .env file.
38 lines
1016 B
Docker
38 lines
1016 B
Docker
# =========== 1) Build stage ===========
|
|
FROM node:22-alpine AS build
|
|
|
|
# No build args needed - using runtime configuration instead
|
|
WORKDIR /usr/src/app
|
|
|
|
# Copy package files
|
|
COPY package*.json ./
|
|
|
|
# Install dependencies
|
|
RUN npm install
|
|
|
|
# Copy the rest of the frontend code
|
|
COPY . .
|
|
|
|
# Build the production bundle WITHOUT baked-in API URL
|
|
# Runtime configuration will be generated from environment variables
|
|
RUN npm run build
|
|
|
|
# =========== 2) Serve stage ===========
|
|
FROM nginx:alpine
|
|
|
|
# Copy production build to Nginx html folder
|
|
COPY --from=build /usr/src/app/dist /usr/share/nginx/html
|
|
|
|
# Copy custom nginx configuration for SPA routing
|
|
COPY --from=build /usr/src/app/nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
# Copy entrypoint script that generates runtime config
|
|
COPY --from=build /usr/src/app/docker-entrypoint.sh /docker-entrypoint.sh
|
|
RUN chmod +x /docker-entrypoint.sh
|
|
|
|
# Expose HTTP port
|
|
EXPOSE 80
|
|
|
|
# Use custom entrypoint that generates config.json from environment
|
|
ENTRYPOINT ["/docker-entrypoint.sh"]
|