-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
76 lines (55 loc) · 2.65 KB
/
Dockerfile
File metadata and controls
76 lines (55 loc) · 2.65 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
# =============================================================================
# Sunset ASP — Fly.io Dockerfile
# Multi-stage build: Rust compilation → Python 3.10 runtime with Node.js
# Build context: repo root (needed because the worker imports preserved legacy helpers)
# =============================================================================
# ---------------------------------------------------------------------------
# Stage 1: Build the Rust binary
# ---------------------------------------------------------------------------
FROM rust:1.93-bookworm AS builder
RUN apt-get update && apt-get install -y pkg-config libssl-dev && rm -rf /var/lib/apt/lists/*
WORKDIR /build/asp
# Copy everything and build
COPY asp/Cargo.toml asp/Cargo.lock ./
COPY asp/src ./src
RUN cargo build --release
# ---------------------------------------------------------------------------
# Stage 2: Runtime (Python 3.10 base — required by garaga)
# ---------------------------------------------------------------------------
FROM python:3.10-slim-bookworm AS runtime
RUN apt-get update && apt-get install -y \
ca-certificates \
curl \
unzip \
libsqlite3-0 \
&& rm -rf /var/lib/apt/lists/*
# Install Node.js 20 LTS (needed by worker for snarkjs/circomlibjs)
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get install -y nodejs \
&& rm -rf /var/lib/apt/lists/*
# Install Bun (used for package management)
RUN curl -fsSL https://bun.sh/install | bash
ENV PATH="/root/.bun/bin:${PATH}"
# Install garaga CLI
RUN pip install --no-cache-dir garaga
WORKDIR /app
# Copy the Rust binary
COPY --from=builder /build/asp/target/release/sunset-asp /usr/local/bin/sunset-asp
# Copy the worker and its dependencies
COPY asp/worker ./asp/worker
RUN cd asp/worker && bun install --frozen-lockfile
# Copy preserved reference circuit helpers imported by the worker
COPY legacy/reference/circuits/scripts/lib ./legacy/reference/circuits/scripts/lib
COPY legacy/reference/circuits/package.json ./legacy/reference/circuits/package.json
RUN cd legacy/reference/circuits && bun install --frozen-lockfile
# Copy circuit build artifacts if they exist
COPY legacy/reference/circuits/buil[d] ./legacy/reference/circuits/build
# Copy garaga verifiers if they exist
COPY legacy/reference/garaga_verifier[s] ./legacy/reference/garaga_verifiers
# Copy dynamic deployment outputs generated by the Solidity deployment flow
COPY contracts/solidity/deployments ./contracts/solidity/deployments
# Create data directory for SQLite persistent volume
RUN mkdir -p /data
ENV DEPLOYED_ADDRESSES_PATH="/app/contracts/solidity/deployments/contracts.json"
EXPOSE 8080
CMD ["sunset-asp"]