diff --git a/frontend/Dockerfile b/frontend/Dockerfile index f43c53d..89d47d6 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -1,6 +1,16 @@ -FROM nginx:alpine AS builder +# Stage 1: Build the frontend +FROM node:20 AS builder -# Install dos2unix to convert Windows line endings +WORKDIR /app +COPY . . + +RUN npm install +RUN npm run build + +# Stage 2: Serve with nginx +FROM nginx:alpine + +# Install dos2unix RUN apk add --no-cache dos2unix # Copy built app @@ -9,14 +19,12 @@ COPY --from=builder /app/dist /usr/share/nginx/html # Copy nginx config COPY nginx.conf /etc/nginx/conf.d/default.conf -# Copy entrypoint + env template +# Copy runtime env template + entrypoint COPY public/env.js.template /usr/share/nginx/html/env.js.template COPY docker-entrypoint.sh /entrypoint.sh -# Fix line endings -RUN dos2unix /entrypoint.sh - -RUN chmod +x /entrypoint.sh +# Normalize line endings and set permissions +RUN dos2unix /entrypoint.sh && chmod +x /entrypoint.sh EXPOSE 80 ENTRYPOINT ["/entrypoint.sh"]