File tree 2 files changed +66
-0
lines changed
2 files changed +66
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Build Docker Images
2
+ on :
3
+ push :
4
+ tags :
5
+ - v*
6
+ workflow_dispatch :
7
+ inputs :
8
+ tag :
9
+ description : " The tag version you want to build"
10
+ jobs :
11
+ build :
12
+ runs-on : ubuntu-latest
13
+ steps :
14
+ - name : Checkout
15
+ uses : actions/checkout@v2
16
+ - name : Setup Docker Buildx
17
+ uses : docker/setup-buildx-action@v1
18
+ - name : Login to GitHub Container Registry
19
+ uses : docker/login-action@v1
20
+ with :
21
+ registry : ghcr.io
22
+ username : ${{ github.repository_owner }}
23
+ password : ${{ secrets.GITHUB_TOKEN }}
24
+ - name : Docker metadata
25
+ id : metadata
26
+ uses : docker/metadata-action@v3
27
+ with :
28
+ images : ghcr.io/sagernet/sing-box
29
+ - name : Get tag to build
30
+ id : tag
31
+ run : |
32
+ if [[ -z "${{ github.event.inputs.tag }}" ]]; then
33
+ echo ::set-output name=tag::ghcr.io/sagernet/sing-box:${{ github.ref_name }}
34
+ else
35
+ echo ::set-output name=tag::ghcr.io/sagernet/sing-box:${{ github.event.inputs.tag }}
36
+ fi
37
+ - name : Build and release Docker images
38
+ uses : docker/build-push-action@v2
39
+ with :
40
+ platforms : linux/386,linux/amd64
41
+ target : dist
42
+ tags : ${{ steps.tag.outputs.tag }}
43
+ push : true
Original file line number Diff line number Diff line change
1
+ FROM golang:1.19-alpine AS builder
2
+ LABEL maintainer=
"nekohasekai <[email protected] >"
3
+ COPY . /go/src/github.com/sagernet/sing-box
4
+ WORKDIR /go/src/github.com/sagernet/sing-box
5
+ ARG GOPROXY=""
6
+ ENV GOPROXY ${GOPROXY}
7
+ ENV CGO_ENABLED=0
8
+ RUN set -ex \
9
+ && apk add git build-base \
10
+ && export COMMIT=$(git rev-parse HEAD) \
11
+ && go build -v -trimpath -tags 'with_quic,with_wireguard,with_clash_api' \
12
+ -o /go/bin/sing-box \
13
+ -ldflags "-X github.com/sagernet/sing-box/constant.Commit=${COMMIT} -w -s -buildid=" \
14
+ ./cmd/sing-box
15
+ FROM alpine AS dist
16
+ LABEL maintainer=
"nekohasekai <[email protected] >"
17
+ RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf
18
+ RUN set -ex \
19
+ && apk upgrade \
20
+ && apk add bash tzdata ca-certificates \
21
+ && rm -rf /var/cache/apk/*
22
+ COPY --from=builder /go/bin/sing-box /usr/local/bin/sing-box
23
+ ENTRYPOINT ["sing-box" ]
You can’t perform that action at this time.
0 commit comments