-
Notifications
You must be signed in to change notification settings - Fork 84
Expand file tree
/
Copy pathDockerfile
More file actions
52 lines (32 loc) · 1.24 KB
/
Dockerfile
File metadata and controls
52 lines (32 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
# Stage 1: Build Contracts using Foundry and Node/pnpm
FROM ghcr.io/foundry-rs/foundry:v1.1.0 AS builder
WORKDIR /build
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml* .gitmodules ./
COPY contracts ./contracts
# --- FIX: Switch to root user to install packages ---
USER root
# ----------------------------------------------------
RUN apt-get update && \
apt-get install -y ca-certificates curl gnupg && \
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
apt-get install -y nodejs && \
rm -rf /var/lib/apt/lists/* && \
corepack enable
RUN pnpm install --frozen-lockfile
RUN pnpm run build:contracts
# ---
# Stage 2: Production Runtime Environment
FROM node:20.12.2-alpine3.19 AS production
WORKDIR /app
RUN npm install -g typescript
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml* ./
RUN corepack enable
COPY . .
COPY --from=builder /build/src/contracts ./src/contracts
RUN pnpm fetch
RUN pnpm install -r --offline --frozen-lockfile
RUN pnpm build
# This is needed for backwards compatibility
# alto.js was previously in /src/lib/cli but is now in /src/esm/cli after changing to ESM
RUN mkdir -p /app/src/lib/cli && ln -sf /app/src/esm/cli/alto.js /app/src/lib/cli/alto.js
ENTRYPOINT ["pnpm", "start"]