-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathDockerfile
More file actions
54 lines (38 loc) · 1.24 KB
/
Dockerfile
File metadata and controls
54 lines (38 loc) · 1.24 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
### STAGE 1: Build ###
FROM node:22-alpine AS build
# Set working directory
WORKDIR /app
# Install dependencies needed for build
RUN apk add --no-cache python3 make g++
# Copy package files
COPY package.json yarn.lock ./
# Install dependencies (increased timeout for slow networks/ARM64 builds)
RUN yarn install --frozen-lockfile --network-timeout 600000
# Copy source code
COPY . .
# Set environment for production web build
ENV APP_ENV=production
ENV NODE_ENV=production
ENV EXPO_PUBLIC_PLATFORM=web
# Build the web application
RUN yarn expo export --platform web
### STAGE 2: Serve ###
FROM nginx:1.25-alpine
# Install envsubst (part of gettext)
RUN apk add --no-cache gettext
# Copy nginx configuration
COPY nginx.conf /etc/nginx/nginx.conf
# Copy built web app from build stage
COPY --from=build /app/dist /usr/share/nginx/html
# Copy the docker entrypoint script
COPY scripts/docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
# Expose port 80
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
# Set the entrypoint
ENTRYPOINT ["/docker-entrypoint.sh"]
# Start nginx
CMD ["nginx", "-g", "daemon off;"]