Fix docker-entrypoint.sh

This commit is contained in:
dvirlabs 2025-07-01 07:26:43 +03:00
parent faa9aaa740
commit 3954963a40
2 changed files with 6 additions and 10 deletions

View File

@ -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;"]

View File

@ -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 "$@"