forked from Adam-Sizzler/cerberus
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
60 lines (45 loc) · 1.82 KB
/
Dockerfile
File metadata and controls
60 lines (45 loc) · 1.82 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
# syntax=docker/dockerfile:1.7
# Multistage build for cerberus-node (Go) + sing-box core (with v2ray_api) + supervisord.
FROM --platform=$TARGETPLATFORM golang:1.25-alpine AS builder
RUN apk update && apk add --no-cache git ca-certificates tzdata gcc musl-dev sqlite-dev
ARG TARGETOS
ARG TARGETARCH
ARG VERSION=unknown
ARG REVISION=unknown
ARG BUILD_TAGS=none
ARG CGO_ENABLED_STATUS=enabled
WORKDIR /build
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=1 \
GOOS="${TARGETOS}" \
GOARCH="${TARGETARCH}" \
go build \
-tags "${BUILD_TAGS}" \
-trimpath \
-buildvcs=true \
-ldflags="-s -w \
-X cerberus-node/constant.Version=${VERSION} \
-X cerberus-node/constant.Revision=${REVISION} \
-X cerberus-node/constant.BuildTags=${BUILD_TAGS} \
-X cerberus-node/constant.CgoEnabled=${CGO_ENABLED_STATUS}" \
-o /build/cerberus-node \
.
FROM --platform=$TARGETPLATFORM alpine:3.23
ARG TARGETARCH
ARG SINGBOX_VERSION=v1.13.3
ENV SINGBOX_VERSION=${SINGBOX_VERSION}
RUN apk update && apk add --no-cache ca-certificates tzdata sqlite-libs curl supervisor
RUN curl -fL "https://github.com/Adam-Sizzler/sing-box-v2ray-api/releases/download/${SINGBOX_VERSION}/sing-box-linux-${TARGETARCH}" \
-o /usr/local/bin/sing-box && \
chmod +x /usr/local/bin/sing-box
WORKDIR /app
COPY --from=builder /build/cerberus-node /app/cerberus-node
COPY deploy/supervisord.conf /etc/supervisord.conf
COPY deploy/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
COPY deploy/singbox-default.json /app/singbox/config.default.json
RUN chmod +x /usr/local/bin/docker-entrypoint.sh && \
mkdir -p /run /var/log/supervisor /app/singbox /app/logs /app/certs
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
CMD ["/app/cerberus-node"]