Fix Dockerfile with dos2unix

This commit is contained in:
dvirlabs 2025-06-15 05:47:06 +03:00
parent e20af98823
commit 7a59b0e338

View File

@ -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 RUN apk add --no-cache dos2unix
# Copy built app # Copy built app
@ -9,14 +19,12 @@ COPY --from=builder /app/dist /usr/share/nginx/html
# Copy nginx config # Copy nginx config
COPY nginx.conf /etc/nginx/conf.d/default.conf 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 public/env.js.template /usr/share/nginx/html/env.js.template
COPY docker-entrypoint.sh /entrypoint.sh COPY docker-entrypoint.sh /entrypoint.sh
# Fix line endings # Normalize line endings and set permissions
RUN dos2unix /entrypoint.sh RUN dos2unix /entrypoint.sh && chmod +x /entrypoint.sh
RUN chmod +x /entrypoint.sh
EXPOSE 80 EXPOSE 80
ENTRYPOINT ["/entrypoint.sh"] ENTRYPOINT ["/entrypoint.sh"]