2025-07-11 14:16:34 +01:00
|
|
|
# Frontend Dockerfile - React/Vite application
|
2026-01-22 20:12:29 +00:00
|
|
|
FROM node:25-alpine@sha256:e80397b81fa93888b5f855e8bef37d9b18d3c5eb38b8731fc23d6d878647340f AS build
|
2025-07-11 14:16:34 +01:00
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
# Copy package files
|
2025-09-26 20:56:26 +01:00
|
|
|
COPY frontend/package.json frontend/package-lock.json ./
|
2025-07-11 14:16:34 +01:00
|
|
|
|
2025-08-26 14:06:29 +01:00
|
|
|
# Install dependencies
|
|
|
|
|
RUN npm ci
|
2025-07-11 14:16:34 +01:00
|
|
|
|
|
|
|
|
# Copy source code
|
2025-07-16 23:09:26 +01:00
|
|
|
COPY frontend .
|
2025-07-11 14:16:34 +01:00
|
|
|
|
2026-05-22 13:40:34 +01:00
|
|
|
# Build the application (vite root is editor/, output lands in editor/dist/)
|
2026-06-02 17:08:24 +01:00
|
|
|
RUN npx vite build editor
|
2025-07-11 14:16:34 +01:00
|
|
|
|
|
|
|
|
# Production stage
|
2026-01-22 20:12:12 +00:00
|
|
|
FROM nginx:alpine@sha256:b0f7830b6bfaa1258f45d94c240ab668ced1b3651c8a222aefe6683447c7bf55
|
2025-07-11 14:16:34 +01:00
|
|
|
|
|
|
|
|
# Copy built files from build stage
|
2026-05-22 13:40:34 +01:00
|
|
|
COPY --from=build /app/editor/dist /usr/share/nginx/html
|
2025-07-11 14:16:34 +01:00
|
|
|
|
|
|
|
|
# Copy nginx configuration and entrypoint
|
2025-07-16 23:09:26 +01:00
|
|
|
COPY docker/frontend/nginx.conf /etc/nginx/nginx.conf
|
|
|
|
|
COPY docker/frontend/entrypoint.sh /entrypoint.sh
|
2025-07-11 14:16:34 +01:00
|
|
|
|
|
|
|
|
# Make entrypoint executable
|
|
|
|
|
RUN chmod +x /entrypoint.sh
|
|
|
|
|
|
|
|
|
|
# Expose port 80 (standard HTTP port)
|
|
|
|
|
EXPOSE 80
|
|
|
|
|
|
|
|
|
|
# Environment variables for flexibility
|
2025-07-18 14:19:36 +01:00
|
|
|
ENV VITE_API_BASE_URL=http://backend:8080
|
2025-07-11 14:16:34 +01:00
|
|
|
|
|
|
|
|
# Use custom entrypoint
|
|
|
|
|
ENTRYPOINT ["/entrypoint.sh"]
|