chore: mainline builder
This commit is contained in:
		
							parent
							
								
									1aefd17648
								
							
						
					
					
						commit
						9ee5c09d8f
					
				
					 6 changed files with 142 additions and 5 deletions
				
			
		
							
								
								
									
										90
									
								
								.github/workflows/build-singbox-docker-mainline.yml
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										90
									
								
								.github/workflows/build-singbox-docker-mainline.yml
									
										
									
									
										vendored
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,90 @@
 | 
			
		|||
name: Build Docker Images (Mainline)
 | 
			
		||||
on:
 | 
			
		||||
  workflow_dispatch:
 | 
			
		||||
    inputs:
 | 
			
		||||
      branch:
 | 
			
		||||
        description: "The branch version you want to build"
 | 
			
		||||
        required: true
 | 
			
		||||
        default: "main"
 | 
			
		||||
        
 | 
			
		||||
jobs:
 | 
			
		||||
  build:
 | 
			
		||||
    strategy:
 | 
			
		||||
      fail-fast: true
 | 
			
		||||
      matrix:
 | 
			
		||||
        buildType: [standard, 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
 | 
			
		||||
							
								
								
									
										6
									
								
								.github/workflows/build-singbox-docker.yml
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								.github/workflows/build-singbox-docker.yml
									
										
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -71,8 +71,10 @@ jobs:
 | 
			
		|||
        id: tag
 | 
			
		||||
        run: |
 | 
			
		||||
          if [[ "${{ matrix.distro }}" == "alpine" && "${{ matrix.buildType }}" == "standard" ]]; then
 | 
			
		||||
            latest="etnperlong/sing-box:latest"
 | 
			
		||||
            echo "latest=$latest" >> $GITHUB_OUTPUT
 | 
			
		||||
            echo "latest=etnperlong/sing-box:latest" >> $GITHUB_OUTPUT
 | 
			
		||||
          fi
 | 
			
		||||
          if [[ "${{ matrix.distro }}" == "distroless" && "${{ matrix.buildType }}" == "standard" ]]; then
 | 
			
		||||
            echo "latest=etnperlong/sing-box:distroless" >> $GITHUB_OUTPUT
 | 
			
		||||
          fi
 | 
			
		||||
          if [[ -z "${{ github.event.inputs.tag }}" ]]; then
 | 
			
		||||
            echo "versioned=etnperlong/sing-box:${{ github.ref_name }}" >> $GITHUB_OUTPUT
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										45
									
								
								README.md
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								README.md
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,45 @@
 | 
			
		|||
# sing-box Docker Image by etnperlong
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
 | 
			
		||||
[sing-box](https://sing-box.sagernet.org/) is a universal proxy platform for building your own proxy.
 | 
			
		||||
 | 
			
		||||
Docker images are built for quick deployment in various computing cloud providers.
 | 
			
		||||
 | 
			
		||||
For more information on docker and containerization technologies, refer to [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
 | 
			
		||||
 | 
			
		||||
- `standard` 
 | 
			
		||||
> `with_gvisor,with_quic,with_wireguard,with_utls,with_reality_server,with_clash_api,with_acme`
 | 
			
		||||
 | 
			
		||||
- `full` 
 | 
			
		||||
> `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`
 | 
			
		||||
 | 
			
		||||
- `mini`
 | 
			
		||||
> `with_quic,with_utls,with_reality_server`
 | 
			
		||||
 | 
			
		||||
## 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))*
 | 
			
		||||
 | 
			
		||||
## Additional distro
 | 
			
		||||
 | 
			
		||||
Add `-distroless` to the end of the tag to use the build of distroless images.
 | 
			
		||||
 | 
			
		||||
For example, `etnperlong/sing-box:dev-next-full-distroless` is the distroless build of full feature enabled image.
 | 
			
		||||
| 
						 | 
				
			
			@ -13,7 +13,7 @@ RUN set -ex \
 | 
			
		|||
        -o /go/bin/sing-box \
 | 
			
		||||
        -ldflags "-X \"github.com/sagernet/sing-box/constant.Version=$VERSION\" -s -w -buildid=" \
 | 
			
		||||
        ./cmd/sing-box
 | 
			
		||||
FROM gcr.io/distroless/base-debian11:nonroot AS dist
 | 
			
		||||
FROM gcr.io/distroless/static-debian11:nonroot AS dist
 | 
			
		||||
LABEL maintainer="Evans Mike <etnperlong@gmail.com>"
 | 
			
		||||
COPY --from=builder /go/bin/sing-box /
 | 
			
		||||
CMD ["/sing-box"]
 | 
			
		||||
| 
						 | 
				
			
			@ -13,7 +13,7 @@ RUN set -ex \
 | 
			
		|||
        -o /go/bin/sing-box \
 | 
			
		||||
        -ldflags "-X \"github.com/sagernet/sing-box/constant.Version=$VERSION\" -s -w -buildid=" \
 | 
			
		||||
        ./cmd/sing-box
 | 
			
		||||
FROM gcr.io/distroless/base-debian11:nonroot AS dist
 | 
			
		||||
FROM gcr.io/distroless/static-debian11:nonroot AS dist
 | 
			
		||||
LABEL maintainer="Evans Mike <etnperlong@gmail.com>"
 | 
			
		||||
COPY --from=builder /go/bin/sing-box /
 | 
			
		||||
CMD ["/sing-box"]
 | 
			
		||||
| 
						 | 
				
			
			@ -13,7 +13,7 @@ RUN set -ex \
 | 
			
		|||
        -o /go/bin/sing-box \
 | 
			
		||||
        -ldflags "-X \"github.com/sagernet/sing-box/constant.Version=$VERSION\" -s -w -buildid=" \
 | 
			
		||||
        ./cmd/sing-box
 | 
			
		||||
FROM gcr.io/distroless/base-debian11:nonroot AS dist
 | 
			
		||||
FROM gcr.io/distroless/static-debian11:nonroot AS dist
 | 
			
		||||
LABEL maintainer="Evans Mike <etnperlong@gmail.com>"
 | 
			
		||||
COPY --from=builder /go/bin/sing-box /
 | 
			
		||||
CMD ["/sing-box"]
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue