forked from MyZubster-Ecosystem/myzubster
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
51 lines (40 loc) · 1.32 KB
/
Copy pathDockerfile
File metadata and controls
51 lines (40 loc) · 1.32 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
45
46
47
48
49
50
51
# ============================================================
# MyZubster Frontend — Dockerfile
# React (react-scripts 5.0.1) with react-leaflet map
# Multi-stage: build → nginx serve
# ============================================================
# ---- Build stage ----
FROM node:20-alpine AS build
WORKDIR /app
# Build args
ARG REACT_APP_API_URL=http://localhost:3009
ENV REACT_APP_API_URL=$REACT_APP_API_URL
# Install dependencies
COPY package.json package-lock.json ./
RUN npm ci --ignore-scripts
# Copy source and build
COPY public/ ./public/
COPY src/ ./src/
RUN npm run build
# ---- Serve stage ----
FROM nginx:alpine AS serve
# Copy built assets from build stage
COPY --from=build /app/build /usr/share/nginx/html
# Minimal nginx config for SPA routing
RUN echo 'server { \
listen 80; \
server_name localhost; \
location / { \
root /usr/share/nginx/html; \
index index.html index.htm; \
try_files $uri $uri/ /index.html; \
} \
error_page 500 502 503 504 /50x.html; \
location = /50x.html { \
root /usr/share/nginx/html; \
} \
}' > /etc/nginx/conf.d/default.conf
EXPOSE 80
HEALTHCHECK --interval=30s --timeout=10s --start-period=20s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:80/ || exit 1
CMD ["nginx", "-g", "daemon off;"]