-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDockerfile
More file actions
53 lines (39 loc) · 1.62 KB
/
Copy pathDockerfile
File metadata and controls
53 lines (39 loc) · 1.62 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
# Trinity Background Agent API — Railway Deployment
# Minimal Zig binary deployment
# φ² + 1/φ² = 3 = TRINITY
# Stage 1: Build
FROM ubuntu:26.04 AS builder
RUN apt-get update && apt-get install -y \
wget xz-utils git \
&& rm -rf /var/lib/apt/lists/*
# Install Zig 0.15.2
# Note: SHA256 verification temporarily disabled (ziglang.org access restricted)
RUN wget -q -O /tmp/zig.tar.xz \
https://ziglang.org/download/0.15.2/zig-x86_64-linux-0.15.2.tar.xz \
&& tar -xf /tmp/zig.tar.xz -C /usr/local \
&& rm /tmp/zig.tar.xz
ENV PATH="/usr/local/zig-x86_64-linux-0.15.2:${PATH}"
WORKDIR /app
COPY . .
# Build background-agent-api.
# The binary lands in .zig-cache/o/<hash>/, so it is resolved to a fixed path
# here, in the stage that has the cache. The runtime stage cannot do this: it
# has no /app and no cache, which is why the find there always failed.
RUN zig build background-agent-api \
&& find /app/.zig-cache -name background-agent-api -type f -exec cp {} /app/background-agent-api \; \
&& test -x /app/background-agent-api
# Stage 2: Runtime - Use Ubuntu minimal
FROM ubuntu:26.04
# Create user first
RUN useradd -m -u 1001 trinity
# Carry the binary over. Without a COPY --from, nothing referenced the builder
# stage at all, so Docker skipped building it and this image shipped empty.
COPY --from=builder /app/background-agent-api /app/background-agent-api
USER trinity
EXPOSE 3000
ENV PORT=3000
ENV LOCAL_MODE=1
# Simple health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
CMD test -f /app/background-agent-api || exit 1
ENTRYPOINT ["/app/background-agent-api"]