-
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.57 KB
/
Copy pathDockerfile
File metadata and controls
51 lines (40 loc) · 1.57 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
# ==============================================================================
# Stage 1: Builder
# ==============================================================================
# Use node:20-slim (Debian) instead of Alpine for better native module compatibility
FROM node:20-slim AS builder
WORKDIR /app
# Install build tools required for compiling native modules like @roamhq/wrtc
RUN apt-get update && apt-get install -y \
python3 \
make \
g++ \
&& rm -rf /var/lib/apt/lists/*
# Install dependencies
COPY package*.json ./
# Install all dependencies (including dev) for building and testing
RUN npm install
# Copy source code
COPY . .
# Build the project
RUN npm run build
# ==============================================================================
# Stage 2: Test Runner / Runtime
# ==============================================================================
FROM node:20-slim
WORKDIR /app
# Install runtime dependencies
# We need netcat-openbsd (nc) for the wait-for-it script and curl for health checks
RUN apt-get update && apt-get install -y \
netcat-openbsd \
curl \
&& rm -rf /var/lib/apt/lists/*
# Copy everything from builder (includes source, dist, node_modules with devDeps)
COPY --from=builder /app ./
# Default environment variables for docker networking
ENV FREEBIRD_ISSUER_URL="http://freebird-issuer:8081"
ENV FREEBIRD_VERIFIER_URL="http://freebird-verifier:8082"
ENV WITNESS_GATEWAY_URL="http://witness-gateway:8080"
ENV HYPERTOKEN_RELAY_URL="ws://hypertoken-relay:3000"
# Default command runs the integration tests
CMD ["npm", "test"]