30 lines
639 B
Docker
30 lines
639 B
Docker
# Stage 1: Build the frontend
|
|
FROM node:20 AS builder
|
|
|
|
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
|
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
|
|
|
# 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 docker-entrypoint.sh /entrypoint.sh
|
|
|
|
# Normalize line endings and set permissions
|
|
RUN dos2unix /entrypoint.sh && chmod +x /entrypoint.sh
|
|
|
|
EXPOSE 80
|
|
ENTRYPOINT ["/entrypoint.sh"] |