Compare commits

..

No commits in common. "50b3e7f42ad61bdf07b4c41957853aa82cc572fa" and "1aefd176487c267f08e89dbdc16d6b2e42f2b284" have entirely different histories.

9 changed files with 19 additions and 258 deletions

View file

@ -1,92 +0,0 @@
name: Build Docker Images (Mainline)
on:
workflow_dispatch:
inputs:
branch:
description: "The branch version you want to build"
required: true
default: "main"
repository_dispatch:
types: [build-mainline]
jobs:
build:
strategy:
fail-fast: true
matrix:
buildType: [full]
distro: [alpine]
runs-on: ubuntu-latest
steps:
- name: Checkout Source Code of 'SagerNet/sing-box'
uses: actions/checkout@v3
with:
repository: 'SagerNet/sing-box'
ref: ${{ github.event.inputs.branch }}
submodules: true
- name: Checkout Action Repo
uses: actions/checkout@v3
with:
path: action
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Setup QEMU for Docker Buildx
uses: docker/setup-qemu-action@v2
- name: Login to Docker Hub Container Registry
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker metadata
id: metadata
uses: docker/metadata-action@v4
with:
images: etnperlong/sing-box
- name: Select Dockerfile
id: dockerfile
run: |
if [[ "${{ matrix.buildType }}" == "full" ]]; then
if [[ "${{ matrix.distro }}" == "distroless" ]]; then
cp "$GITHUB_WORKSPACE/action/dockerfiles/Dockerfile.distroless.full" "$GITHUB_WORKSPACE/Dockerfile"
echo "tagpost=full-distroless" >> $GITHUB_OUTPUT
else
cp "$GITHUB_WORKSPACE/action/dockerfiles/Dockerfile.full" "$GITHUB_WORKSPACE/Dockerfile"
# echo "tagpost=full" >> $GITHUB_OUTPUT
fi
elif [[ "${{ matrix.buildType }}" == "minimized" ]]; then
if [[ "${{ matrix.distro }}" == "distroless" ]]; then
cp "$GITHUB_WORKSPACE/action/dockerfiles/Dockerfile.distroless.minimized" "$GITHUB_WORKSPACE/Dockerfile"
echo "tagpost=mini-distroless" >> $GITHUB_OUTPUT
else
cp "$GITHUB_WORKSPACE/action/dockerfiles/Dockerfile.minimized" "$GITHUB_WORKSPACE/Dockerfile"
echo "tagpost=mini" >> $GITHUB_OUTPUT
fi
else
if [[ "${{ matrix.distro }}" == "distroless" ]]; then
cp "$GITHUB_WORKSPACE/action/dockerfiles/Dockerfile.distroless.standard" "$GITHUB_WORKSPACE/Dockerfile"
echo "tagpost=distroless" >> $GITHUB_OUTPUT
else
cp "$GITHUB_WORKSPACE/action/dockerfiles/Dockerfile.standard" "$GITHUB_WORKSPACE/Dockerfile"
fi
fi
- name: Get tag to build
id: tag
run: |
if [[ -z "${{ github.event.inputs.branch }}" ]]; then
echo "versioned=etnperlong/sing-box:${{ github.ref_name }}" >> $GITHUB_OUTPUT
else
if [[ -n "${{ steps.dockerfile.outputs.tagpost }}" ]]; then
echo "versioned=etnperlong/sing-box:${{ github.event.inputs.branch }}-${{ steps.dockerfile.outputs.tagpost }}" >> $GITHUB_OUTPUT
else
echo "versioned=etnperlong/sing-box:${{ github.event.inputs.branch }}" >> $GITHUB_OUTPUT
fi
fi
- name: Build and release Docker images
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64,linux/arm/v7
target: dist
tags: |
${{ steps.tag.outputs.versioned }}
push: true

View file

@ -1,103 +0,0 @@
name: Build Docker Images (Pre-Release)
on:
workflow_dispatch:
inputs:
tag:
description: "The tag version you want to build"
required: true
default: "main"
repository_dispatch:
types: [build-prerelease]
jobs:
build:
strategy:
fail-fast: true
matrix:
buildType: [full]
distro: [alpine]
runs-on: ubuntu-latest
env:
TAG: ${{ github.event.client_payload.tag || github.event.inputs.tag}}
steps:
- name: Get Build Tags
run: |
echo "Version: ${{env.TAG}}"
- name: Checkout Source Code of 'SagerNet/sing-box'
uses: actions/checkout@v3
with:
repository: 'SagerNet/sing-box'
ref: ${{env.TAG}}
submodules: true
- name: Checkout Action Repo
uses: actions/checkout@v3
with:
path: action
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Setup QEMU for Docker Buildx
uses: docker/setup-qemu-action@v2
- name: Login to Docker Hub Container Registry
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker metadata
id: metadata
uses: docker/metadata-action@v4
with:
images: etnperlong/sing-box
- name: Select Dockerfile
id: dockerfile
run: |
if [[ "${{ matrix.buildType }}" == "full" ]]; then
if [[ "${{ matrix.distro }}" == "distroless" ]]; then
cp "$GITHUB_WORKSPACE/action/dockerfiles/Dockerfile.distroless.full" "$GITHUB_WORKSPACE/Dockerfile"
echo "tagpost=full-distroless" >> $GITHUB_OUTPUT
else
cp "$GITHUB_WORKSPACE/action/dockerfiles/Dockerfile.full" "$GITHUB_WORKSPACE/Dockerfile"
# echo "tagpost=full" >> $GITHUB_OUTPUT
fi
elif [[ "${{ matrix.buildType }}" == "minimized" ]]; then
if [[ "${{ matrix.distro }}" == "distroless" ]]; then
cp "$GITHUB_WORKSPACE/action/dockerfiles/Dockerfile.distroless.minimized" "$GITHUB_WORKSPACE/Dockerfile"
echo "tagpost=mini-distroless" >> $GITHUB_OUTPUT
else
cp "$GITHUB_WORKSPACE/action/dockerfiles/Dockerfile.minimized" "$GITHUB_WORKSPACE/Dockerfile"
echo "tagpost=mini" >> $GITHUB_OUTPUT
fi
else
if [[ "${{ matrix.distro }}" == "distroless" ]]; then
cp "$GITHUB_WORKSPACE/action/dockerfiles/Dockerfile.distroless.standard" "$GITHUB_WORKSPACE/Dockerfile"
echo "tagpost=distroless" >> $GITHUB_OUTPUT
else
cp "$GITHUB_WORKSPACE/action/dockerfiles/Dockerfile.standard" "$GITHUB_WORKSPACE/Dockerfile"
fi
fi
- name: Get tag to build
id: tag
run: |
if [[ "${{ matrix.distro }}" == "alpine" && "${{ matrix.buildType }}" == "full" ]]; then
echo "latest=etnperlong/sing-box:latest" >> $GITHUB_OUTPUT
fi
if [[ "${{ matrix.distro }}" == "distroless" && "${{ matrix.buildType }}" == "full" ]]; then
echo "latest=etnperlong/sing-box:distroless" >> $GITHUB_OUTPUT
fi
if [[ -z "${{env.TAG}}" ]]; then
echo "versioned=etnperlong/sing-box:${{ github.ref_name }}" >> $GITHUB_OUTPUT
else
if [[ -n "${{ steps.dockerfile.outputs.tagpost }}" ]]; then
echo "versioned=etnperlong/sing-box:${{env.TAG}}-${{ steps.dockerfile.outputs.tagpost }}" >> $GITHUB_OUTPUT
else
echo "versioned=etnperlong/sing-box:${{env.TAG}}" >> $GITHUB_OUTPUT
fi
fi
- name: Build and pre-release Docker images
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64,linux/arm/v7
target: dist
tags: |
${{ steps.tag.outputs.versioned }}
push: true

View file

@ -6,28 +6,21 @@ on:
description: "The tag version you want to build" description: "The tag version you want to build"
required: true required: true
default: "main" default: "main"
repository_dispatch:
types: [build-release]
jobs: jobs:
build: build:
strategy: strategy:
fail-fast: true fail-fast: true
matrix: matrix:
buildType: [full] buildType: [standard, minimized, full]
distro: [alpine] distro: [alpine, distroless]
runs-on: ubuntu-latest runs-on: ubuntu-latest
env:
TAG: ${{ github.event.client_payload.tag || github.event.inputs.tag}}
steps: steps:
- name: Get Build Tags
run: |
echo "Version: ${{env.TAG}}"
- name: Checkout Source Code of 'SagerNet/sing-box' - name: Checkout Source Code of 'SagerNet/sing-box'
uses: actions/checkout@v3 uses: actions/checkout@v3
with: with:
repository: 'SagerNet/sing-box' repository: 'SagerNet/sing-box'
ref: ${{env.TAG}} ref: ${{ github.event.inputs.tag }}
submodules: true submodules: true
- name: Checkout Action Repo - name: Checkout Action Repo
uses: actions/checkout@v3 uses: actions/checkout@v3
@ -56,7 +49,7 @@ jobs:
echo "tagpost=full-distroless" >> $GITHUB_OUTPUT echo "tagpost=full-distroless" >> $GITHUB_OUTPUT
else else
cp "$GITHUB_WORKSPACE/action/dockerfiles/Dockerfile.full" "$GITHUB_WORKSPACE/Dockerfile" cp "$GITHUB_WORKSPACE/action/dockerfiles/Dockerfile.full" "$GITHUB_WORKSPACE/Dockerfile"
# echo "tagpost=full" >> $GITHUB_OUTPUT echo "tagpost=full" >> $GITHUB_OUTPUT
fi fi
elif [[ "${{ matrix.buildType }}" == "minimized" ]]; then elif [[ "${{ matrix.buildType }}" == "minimized" ]]; then
if [[ "${{ matrix.distro }}" == "distroless" ]]; then if [[ "${{ matrix.distro }}" == "distroless" ]]; then
@ -77,19 +70,17 @@ jobs:
- name: Get tag to build - name: Get tag to build
id: tag id: tag
run: | run: |
if [[ "${{ matrix.distro }}" == "alpine" && "${{ matrix.buildType }}" == "full" ]]; then if [[ "${{ matrix.distro }}" == "alpine" && "${{ matrix.buildType }}" == "standard" ]]; then
echo "latest=etnperlong/sing-box:latest" >> $GITHUB_OUTPUT latest="etnperlong/sing-box:latest"
echo "latest=$latest" >> $GITHUB_OUTPUT
fi fi
if [[ "${{ matrix.distro }}" == "distroless" && "${{ matrix.buildType }}" == "full" ]]; then if [[ -z "${{ github.event.inputs.tag }}" ]]; then
echo "latest=etnperlong/sing-box:distroless" >> $GITHUB_OUTPUT
fi
if [[ -z "${{env.TAG}}" ]]; then
echo "versioned=etnperlong/sing-box:${{ github.ref_name }}" >> $GITHUB_OUTPUT echo "versioned=etnperlong/sing-box:${{ github.ref_name }}" >> $GITHUB_OUTPUT
else else
if [[ -n "${{ steps.dockerfile.outputs.tagpost }}" ]]; then if [[ -n "${{ steps.dockerfile.outputs.tagpost }}" ]]; then
echo "versioned=etnperlong/sing-box:${{env.TAG}}-${{ steps.dockerfile.outputs.tagpost }}" >> $GITHUB_OUTPUT echo "versioned=etnperlong/sing-box:${{ github.event.inputs.tag }}-${{ steps.dockerfile.outputs.tagpost }}" >> $GITHUB_OUTPUT
else else
echo "versioned=etnperlong/sing-box:${{env.TAG}}" >> $GITHUB_OUTPUT echo "versioned=etnperlong/sing-box:${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT
fi fi
fi fi
- name: Build and release Docker images - name: Build and release Docker images

View file

@ -1,35 +0,0 @@
# sing-box Docker Image by etnperlong
![Docker Stars](https://img.shields.io/docker/stars/etnperlong/sing-box.svg) ![Docker Pulls](https://img.shields.io/docker/pulls/etnperlong/sing-box.svg)
[sing-box](https://sing-box.sagernet.org/) is a universal proxy platform for building your own proxy.
Docker images are designed for rapid deployment to various computing cloud providers.
For more information on Docker and containerization technologies, read the [official document](https://docs.docker.com/).
## Documentation
[https://sing-box.sagernet.org](https://sing-box.sagernet.org)
## Community
[https://community.sagernet.org/c/sing-box/](https://community.sagernet.org/c/sing-box/)
## Supported architectures
- amd64
- arm64
- arm/v7
## Enabled features
**Full version!**
> `with_gvisor,with_quic,with_grpc,with_dhcp,with_wireguard,with_shadowsocksr,with_ech,with_utls,with_reality_server,with_clash_api,with_v2ray_api,with_acme`
## Supported tags
- `latest` *([latest release](https://github.com/SagerNet/sing-box/releases))*
- `main` *([main branch](https://github.com/SagerNet/sing-box/tree/main))*
- `dev` *([dev branch](https://github.com/SagerNet/sing-box/tree/dev))*
- `dev-next` *([dev-next branch](https://github.com/SagerNet/sing-box/tree/dev))*
For example, `etnperlong/sing-box:dev-next` means a fully functional docker image.

View file

@ -13,7 +13,7 @@ RUN set -ex \
-o /go/bin/sing-box \ -o /go/bin/sing-box \
-ldflags "-X \"github.com/sagernet/sing-box/constant.Version=$VERSION\" -s -w -buildid=" \ -ldflags "-X \"github.com/sagernet/sing-box/constant.Version=$VERSION\" -s -w -buildid=" \
./cmd/sing-box ./cmd/sing-box
FROM gcr.io/distroless/static-debian11:latest AS dist FROM gcr.io/distroless/base-debian11:nonroot AS dist
LABEL maintainer="Evans Mike <etnperlong@gmail.com>" LABEL maintainer="Evans Mike <etnperlong@gmail.com>"
COPY --from=builder /go/bin/sing-box / COPY --from=builder /go/bin/sing-box /
ENTRYPOINT ["/sing-box"] CMD ["/sing-box"]

View file

@ -13,7 +13,7 @@ RUN set -ex \
-o /go/bin/sing-box \ -o /go/bin/sing-box \
-ldflags "-X \"github.com/sagernet/sing-box/constant.Version=$VERSION\" -s -w -buildid=" \ -ldflags "-X \"github.com/sagernet/sing-box/constant.Version=$VERSION\" -s -w -buildid=" \
./cmd/sing-box ./cmd/sing-box
FROM gcr.io/distroless/static-debian11:latest AS dist FROM gcr.io/distroless/base-debian11:nonroot AS dist
LABEL maintainer="Evans Mike <etnperlong@gmail.com>" LABEL maintainer="Evans Mike <etnperlong@gmail.com>"
COPY --from=builder /go/bin/sing-box / COPY --from=builder /go/bin/sing-box /
ENTRYPOINT ["/sing-box"] CMD ["/sing-box"]

View file

@ -13,7 +13,7 @@ RUN set -ex \
-o /go/bin/sing-box \ -o /go/bin/sing-box \
-ldflags "-X \"github.com/sagernet/sing-box/constant.Version=$VERSION\" -s -w -buildid=" \ -ldflags "-X \"github.com/sagernet/sing-box/constant.Version=$VERSION\" -s -w -buildid=" \
./cmd/sing-box ./cmd/sing-box
FROM gcr.io/distroless/static-debian11:latest AS dist FROM gcr.io/distroless/base-debian11:nonroot AS dist
LABEL maintainer="Evans Mike <etnperlong@gmail.com>" LABEL maintainer="Evans Mike <etnperlong@gmail.com>"
COPY --from=builder /go/bin/sing-box / COPY --from=builder /go/bin/sing-box /
ENTRYPOINT ["/sing-box"] CMD ["/sing-box"]

View file

@ -1,4 +1,4 @@
FROM golang:1.21-alpine AS builder FROM golang:1.20-alpine AS builder
LABEL maintainer="nekohasekai <contact-git@sekai.icu>" LABEL maintainer="nekohasekai <contact-git@sekai.icu>"
COPY . /go/src/github.com/sagernet/sing-box COPY . /go/src/github.com/sagernet/sing-box
WORKDIR /go/src/github.com/sagernet/sing-box WORKDIR /go/src/github.com/sagernet/sing-box
@ -9,7 +9,7 @@ RUN set -ex \
&& apk add git build-base \ && apk add git build-base \
&& export COMMIT=$(git rev-parse --short HEAD) \ && export COMMIT=$(git rev-parse --short HEAD) \
&& export VERSION=$(go run ./cmd/internal/read_tag) \ && export VERSION=$(go run ./cmd/internal/read_tag) \
&& go build -v -trimpath -tags with_gvisor,with_quic,with_grpc,with_dhcp,with_wireguard,with_ech,with_utls,with_reality_server,with_clash_api,with_acme,with_v2ray_api \ && go build -v -trimpath -tags with_gvisor,with_quic,with_grpc,with_dhcp,with_wireguard,with_shadowsocksr,with_ech,with_utls,with_reality_server,with_clash_api,with_v2ray_api,with_acme \
-o /go/bin/sing-box \ -o /go/bin/sing-box \
-ldflags "-X \"github.com/sagernet/sing-box/constant.Version=$VERSION\" -s -w -buildid=" \ -ldflags "-X \"github.com/sagernet/sing-box/constant.Version=$VERSION\" -s -w -buildid=" \
./cmd/sing-box ./cmd/sing-box

View file

@ -9,7 +9,7 @@ RUN set -ex \
&& apk add git build-base \ && apk add git build-base \
&& export COMMIT=$(git rev-parse --short HEAD) \ && export COMMIT=$(git rev-parse --short HEAD) \
&& export VERSION=$(go run ./cmd/internal/read_tag) \ && export VERSION=$(go run ./cmd/internal/read_tag) \
&& go build -v -trimpath -tags with_gvisor,with_quic,with_dhcp,with_wireguard,with_utls,with_reality_server,with_clash_api,with_acme \ && go build -v -trimpath -tags with_gvisor,with_quic,with_wireguard,with_utls,with_reality_server,with_clash_api,with_acme \
-o /go/bin/sing-box \ -o /go/bin/sing-box \
-ldflags "-X \"github.com/sagernet/sing-box/constant.Version=$VERSION\" -s -w -buildid=" \ -ldflags "-X \"github.com/sagernet/sing-box/constant.Version=$VERSION\" -s -w -buildid=" \
./cmd/sing-box ./cmd/sing-box