-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
66 lines (52 loc) · 1.9 KB
/
Copy pathDockerfile
File metadata and controls
66 lines (52 loc) · 1.9 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
### STAGE 1: Build ###
# The web export is architecture-independent static output, so always run this stage on the
# builder's native platform ($BUILDPLATFORM). Without this, multi-arch builds run Metro under
# QEMU emulation, where Node crashes (illegal instruction) mid-bundle on arm64.
FROM --platform=$BUILDPLATFORM node:22-alpine AS build
# Install build dependencies
RUN apk add --no-cache python3 make g++
WORKDIR /app
# Copy package files
COPY package.json yarn.lock ./
# Install dependencies
RUN yarn install --frozen-lockfile
# Copy source files
COPY . .
# Build the web application with production defaults
# Runtime environment variables will be injected at startup via docker-entrypoint.sh
# APP_ENV=production ensures the build uses production defaults and no .env suffix on IDs
RUN APP_ENV=production yarn web:build
### STAGE 2: Run ###
FROM nginx:1.25-alpine
# Install sed for the entrypoint script
RUN apk add --no-cache sed
# 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 entrypoint script
COPY docker/docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
# Expose port 80
EXPOSE 80
# Set default environment variables
ENV APP_ENV=production \
IC_NAME="Resgrid IC" \
IC_SCHEME="ResgridIC" \
IC_BUNDLE_ID="com.resgrid.command" \
IC_PACKAGE="com.resgrid.command" \
IC_VERSION="0.0.1" \
IC_BASE_API_URL="https://api.resgrid.com" \
IC_API_VERSION="v4" \
IC_RESGRID_API_URL="/api/v4" \
IC_CHANNEL_HUB_NAME="eventingHub" \
IC_REALTIME_GEO_HUB_NAME="geolocationHub" \
IC_LOGGING_KEY="" \
IC_APP_KEY="" \
IC_MAPBOX_PUBKEY="" \
IC_SENTRY_DSN="" \
IC_COUNTLY_APP_KEY="" \
IC_COUNTLY_SERVER_URL=""
# Use entrypoint to inject environment variables at runtime
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["nginx", "-g", "daemon off;"]