-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
95 lines (71 loc) · 1.84 KB
/
Dockerfile
File metadata and controls
95 lines (71 loc) · 1.84 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# ================================
# Chrono - Expo React Native App
# Multi-stage Dockerfile
# ================================
# ====================
# Stage 1: Base Image
# ====================
FROM node:20-alpine AS base
# Install system dependencies
RUN apk add --no-cache \
git \
python3 \
make \
g++ \
&& rm -rf /var/cache/apk/*
# Set working directory
WORKDIR /app
# ====================
# Stage 2: Dependencies
# ====================
FROM base AS deps
# Copy package files
COPY package.json package-lock.json ./
# Install dependencies
RUN npm ci --legacy-peer-deps
# ====================
# Stage 3: Development
# ====================
FROM base AS development
WORKDIR /app
# Copy dependencies from deps stage
COPY --from=deps /app/node_modules ./node_modules
# Copy source code
COPY . .
# Expose Expo ports
# Metro bundler (default)
EXPOSE 8081
# Expo DevTools
EXPOSE 19000
EXPOSE 19001
EXPOSE 19002
# Environment variables
ENV EXPO_DEVTOOLS_LISTEN_ADDRESS=0.0.0.0
ENV REACT_NATIVE_PACKAGER_HOSTNAME=0.0.0.0
# Start Expo development server
CMD ["npx", "expo", "start", "--tunnel"]
# ====================
# Stage 4: Web Build
# ====================
FROM base AS web-builder
WORKDIR /app
# Copy dependencies from deps stage
COPY --from=deps /app/node_modules ./node_modules
# Copy source code
COPY . .
# Build web version
RUN npx expo export --platform web
# ====================
# Stage 5: Web Production
# ====================
FROM nginx:alpine AS web-production
# Copy custom nginx config
COPY nginx.conf /etc/nginx/nginx.conf
# Copy built web files
COPY --from=web-builder /app/dist /usr/share/nginx/html
# Expose HTTP port
EXPOSE 80
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:80/ || exit 1
CMD ["nginx", "-g", "daemon off;"]