32 lines
766 B
Docker
32 lines
766 B
Docker
# Multi-stage build combining frontend and nginx
|
|
FROM node:18-alpine AS frontend-build
|
|
|
|
WORKDIR /app/frontend
|
|
|
|
# Copy frontend files
|
|
COPY frontend/package*.json ./
|
|
RUN npm install
|
|
|
|
COPY frontend/ ./
|
|
RUN npm run build
|
|
|
|
# Final stage with nginx
|
|
FROM nginx:alpine
|
|
|
|
# Remove default nginx config
|
|
RUN rm /etc/nginx/conf.d/default.conf
|
|
|
|
# Copy custom nginx configuration
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
# Copy built frontend from previous stage
|
|
COPY --from=frontend-build /app/frontend/dist/ldpv2-frontend/browser /usr/share/nginx/html
|
|
|
|
# Expose port 80
|
|
EXPOSE 80
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
|
CMD wget --quiet --tries=1 --spider http://localhost:80/ || exit 1
|
|
|
|
CMD ["nginx", "-g", "daemon off;"] |