diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 7bd39cf..016d5b1 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -3,7 +3,6 @@ FROM node:20 AS builder WORKDIR /app COPY . . - RUN npm install RUN npm run build @@ -16,18 +15,16 @@ RUN apk add --no-cache dos2unix # Copy built app COPY --from=builder /app/dist /usr/share/nginx/html +# ✅ Move the env.js.template to separate folder +COPY public/env.js.template /etc/env/env.js.template + # Copy nginx config COPY nginx.conf /etc/nginx/conf.d/default.conf -# Copy runtime env template + entrypoint -COPY public/env.js.template /usr/share/nginx/html/env.js.template +# Copy entrypoint COPY docker-entrypoint.sh /entrypoint.sh - -# Normalize line endings and set permissions RUN dos2unix /entrypoint.sh && chmod +x /entrypoint.sh EXPOSE 80 - -# ✅ חשוב מאוד: הגדר גם ENTRYPOINT וגם CMD ENTRYPOINT ["/entrypoint.sh"] CMD ["nginx", "-g", "daemon off;"] diff --git a/frontend/docker-entrypoint.sh b/frontend/docker-entrypoint.sh index db1a619..8754fa0 100644 --- a/frontend/docker-entrypoint.sh +++ b/frontend/docker-entrypoint.sh @@ -1,7 +1,6 @@ #!/bin/sh -# מחליף את הטמפלייט במשתנה האמיתי שהוזן כ־ENV -envsubst < /usr/share/nginx/html/env.js.template > /usr/share/nginx/html/env.js +# שימוש ב-template ממקום שלא נדרס +envsubst < /etc/env/env.js.template > /usr/share/nginx/html/env.js -# מריץ את הפקודה שהוגדרה ב־CMD (nginx...) exec "$@"