feat(smart-app): add Docker web build + Traefik integration

This commit is contained in:
Eric FELIXINE
2026-06-01 22:49:31 -04:00
parent 43ae2ebcac
commit fd583a8b16
2 changed files with 84 additions and 17 deletions

View File

@@ -0,0 +1,42 @@
# Smart App City — Web build (Expo/React Native Web)
# Build stage
FROM node:20-alpine AS builder
WORKDIR /app
# Copy package files
COPY package.json package-lock.json ./
# Install dependencies
RUN npm ci --legacy-peer-deps
# Copy source
COPY . .
# Build web version
RUN npx expo export --platform web --output-dir dist
# Serve stage — lightweight nginx
FROM nginx:alpine
# Copy built assets
COPY --from=builder /app/dist /usr/share/nginx/html
# Nginx config for SPA routing
RUN echo 'server { \
listen 80; \
server_name _; \
root /usr/share/nginx/html; \
index index.html; \
location / { \
try_files $uri $uri/ /index.html; \
} \
location ~* \.(js|css|png|jpg|jpeg|gif|svg|ico|woff|woff2|ttf|eot)$ { \
expires 1y; \
add_header Cache-Control "public, immutable"; \
} \
}' > /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]