This repository was archived by the owner on Nov 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed
Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change 1+ # Build stage
2+ FROM golang:1.22 as builder
3+
4+ # Set working directory
5+ WORKDIR /tmp
6+
7+ # Install dependencies
8+ # RUN apk add --no-cache make gcc musl-dev linux-headers git
9+ RUN apt-get update && apt-get install -y git musl-dev make
10+
11+ # Clean the Go module cache
12+ RUN go clean -modcache
13+
14+ # Clone the specific branch of the Sonic repository and build the application
15+ RUN git clone --depth 1 --branch v1.2.1-f https://github.com/Fantom-foundation/Sonic.git && \
16+ cd Sonic && \
17+ make all
18+
19+ # Final stage
20+ FROM alpine:latest
21+
22+ # Set working directory
23+ WORKDIR /root/.sonic
24+
25+ # Install ca-certificates for HTTPS
26+ RUN apk add --no-cache ca-certificates
27+
28+ # Copy binaries from builder stage
29+ COPY --from=builder /tmp/Sonic/build/sonicd /usr/local/bin/
30+ COPY --from=builder /tmp/Sonic/build/sonictool /usr/local/bin/
31+
32+ # Create a non-root user
33+ RUN adduser -D -u 1000 sonic
34+
35+ # Switch to non-root user
36+ USER sonic
37+
38+ # Expose necessary ports
39+ EXPOSE 5050 5050/udp 80 18546 18545
40+
41+ # Set the entrypoint (default to running sonicd, but can be overridden)
42+ ENTRYPOINT ["sonicd" ]
You can’t perform that action at this time.
0 commit comments