-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
44 lines (32 loc) · 1.07 KB
/
Dockerfile
File metadata and controls
44 lines (32 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Multi-stage Dockerfile for CoMapeo Alerts Commander
# Stage 1: Build the React application
FROM node:20-alpine AS builder
# Set working directory
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install dependencies (including dev dependencies needed for build)
RUN npm ci
# Copy source code
COPY . .
# Accept build arguments for Vite environment variables
ARG VITE_MAPBOX_TOKEN
# Make build args available as environment variables during build
# Vite will pick these up and bake them into the static bundle
ENV VITE_MAPBOX_TOKEN=$VITE_MAPBOX_TOKEN
# Build the application
# The build command runs: vite build
RUN npm run build
# Stage 2: Serve the application with nginx
FROM nginx:alpine
# Copy built assets from builder stage
COPY --from=builder /app/dist /usr/share/nginx/html
# Copy nginx configuration
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Expose port 80
EXPOSE 80
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD wget -q -O /dev/null http://localhost/ || exit 1
# Start nginx
CMD ["nginx", "-g", "daemon off;"]