-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
43 lines (36 loc) · 1.37 KB
/
Dockerfile
File metadata and controls
43 lines (36 loc) · 1.37 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
FROM --platform=$BUILDPLATFORM golang:1.25.0-bookworm AS builder
ARG TARGETOS TARGETARCH
ARG GOPROXY=""
ARG VERSION=""
ARG COMMIT=""
RUN set -ex \
&& apt-get update \
&& if [ "$TARGETARCH" = "arm64" ]; then \
apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu qemu-user; \
else \
apt-get install -y gcc g++; \
fi \
&& rm -rf /var/lib/apt/lists/*
WORKDIR $GOPATH/src/getlantern/lantern-box/
COPY . .
ENV CGO_ENABLED=1
ENV GOOS=$TARGETOS
ENV GOARCH=$TARGETARCH
RUN set -ex \
&& if [ "$TARGETARCH" = "arm64" ]; then \
export CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++; \
else \
export CC=gcc CXX=g++; \
fi && \
echo "Building for $GOOS/$GOARCH using CC=$CC CXX=$CXX" && \
go build -v -tags "with_gvisor,with_quic,with_dhcp,with_wireguard,with_utls,with_acme,with_clash_api" \
-ldflags="-X main.version=${VERSION} -X main.commit=${COMMIT}" \
-o /usr/local/bin/lantern-box ./cmd
FROM debian:bookworm-slim
# Keep runtime deps in sync with deploy/packer/provision.sh
RUN set -ex \
&& apt-get update \
&& apt-get install -y ca-certificates tzdata nftables wireguard-tools \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /usr/local/bin/lantern-box /usr/local/bin/lantern-box
ENTRYPOINT ["/usr/local/bin/lantern-box", "run", "--config", "/config.json"]