mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	Backport #25317 by @techknowlogick followup of https://github.com/go-gitea/gitea/pull/25308 this time to build & push nightly docker images Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
		
							
								
								
									
										304
									
								
								.drone.yml
									
									
									
									
									
								
							
							
						
						
									
										304
									
								
								.drone.yml
									
									
									
									
									
								
							@@ -244,133 +244,6 @@ steps:
 | 
				
			|||||||
        exclude:
 | 
					        exclude:
 | 
				
			||||||
        - pull_request
 | 
					        - pull_request
 | 
				
			||||||
 | 
					
 | 
				
			||||||
---
 | 
					 | 
				
			||||||
kind: pipeline
 | 
					 | 
				
			||||||
type: docker
 | 
					 | 
				
			||||||
name: docker-linux-amd64-release
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
platform:
 | 
					 | 
				
			||||||
  os: linux
 | 
					 | 
				
			||||||
  arch: amd64
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
trigger:
 | 
					 | 
				
			||||||
  ref:
 | 
					 | 
				
			||||||
  - refs/heads/main
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
steps:
 | 
					 | 
				
			||||||
  - name: fetch-tags
 | 
					 | 
				
			||||||
    image: docker:git
 | 
					 | 
				
			||||||
    pull: always
 | 
					 | 
				
			||||||
    commands:
 | 
					 | 
				
			||||||
      - git fetch --tags --force
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  - name: publish
 | 
					 | 
				
			||||||
    image: plugins/docker:latest
 | 
					 | 
				
			||||||
    pull: always
 | 
					 | 
				
			||||||
    settings:
 | 
					 | 
				
			||||||
      auto_tag: false
 | 
					 | 
				
			||||||
      tags: nightly-linux-amd64
 | 
					 | 
				
			||||||
      repo: gitea/gitea
 | 
					 | 
				
			||||||
      build_args:
 | 
					 | 
				
			||||||
        - GOPROXY=https://goproxy.io
 | 
					 | 
				
			||||||
      password:
 | 
					 | 
				
			||||||
        from_secret: docker_password
 | 
					 | 
				
			||||||
      username:
 | 
					 | 
				
			||||||
        from_secret: docker_username
 | 
					 | 
				
			||||||
    environment:
 | 
					 | 
				
			||||||
      PLUGIN_MIRROR:
 | 
					 | 
				
			||||||
        from_secret: plugin_mirror
 | 
					 | 
				
			||||||
      DOCKER_BUILDKIT: 1
 | 
					 | 
				
			||||||
    when:
 | 
					 | 
				
			||||||
      event:
 | 
					 | 
				
			||||||
        exclude:
 | 
					 | 
				
			||||||
        - pull_request
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  - name: publish-rootless
 | 
					 | 
				
			||||||
    image: plugins/docker:latest
 | 
					 | 
				
			||||||
    settings:
 | 
					 | 
				
			||||||
      dockerfile: Dockerfile.rootless
 | 
					 | 
				
			||||||
      auto_tag: false
 | 
					 | 
				
			||||||
      tags: nightly-linux-amd64-rootless
 | 
					 | 
				
			||||||
      repo: gitea/gitea
 | 
					 | 
				
			||||||
      build_args:
 | 
					 | 
				
			||||||
        - GOPROXY=https://goproxy.io
 | 
					 | 
				
			||||||
      password:
 | 
					 | 
				
			||||||
        from_secret: docker_password
 | 
					 | 
				
			||||||
      username:
 | 
					 | 
				
			||||||
        from_secret: docker_username
 | 
					 | 
				
			||||||
    environment:
 | 
					 | 
				
			||||||
      PLUGIN_MIRROR:
 | 
					 | 
				
			||||||
        from_secret: plugin_mirror
 | 
					 | 
				
			||||||
      DOCKER_BUILDKIT: 1
 | 
					 | 
				
			||||||
    when:
 | 
					 | 
				
			||||||
      event:
 | 
					 | 
				
			||||||
        exclude:
 | 
					 | 
				
			||||||
        - pull_request
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
---
 | 
					 | 
				
			||||||
kind: pipeline
 | 
					 | 
				
			||||||
name: docker-linux-amd64-release-branch
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
platform:
 | 
					 | 
				
			||||||
  os: linux
 | 
					 | 
				
			||||||
  arch: amd64
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
trigger:
 | 
					 | 
				
			||||||
  ref:
 | 
					 | 
				
			||||||
  - "refs/heads/release/v*"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
steps:
 | 
					 | 
				
			||||||
  - name: fetch-tags
 | 
					 | 
				
			||||||
    image: docker:git
 | 
					 | 
				
			||||||
    pull: always
 | 
					 | 
				
			||||||
    commands:
 | 
					 | 
				
			||||||
      - git fetch --tags --force
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  - name: publish
 | 
					 | 
				
			||||||
    image: plugins/docker:latest
 | 
					 | 
				
			||||||
    pull: always
 | 
					 | 
				
			||||||
    settings:
 | 
					 | 
				
			||||||
      auto_tag: false
 | 
					 | 
				
			||||||
      tags: ${DRONE_BRANCH##release/v}-nightly-linux-amd64
 | 
					 | 
				
			||||||
      repo: gitea/gitea
 | 
					 | 
				
			||||||
      build_args:
 | 
					 | 
				
			||||||
        - GOPROXY=https://goproxy.io
 | 
					 | 
				
			||||||
      password:
 | 
					 | 
				
			||||||
        from_secret: docker_password
 | 
					 | 
				
			||||||
      username:
 | 
					 | 
				
			||||||
        from_secret: docker_username
 | 
					 | 
				
			||||||
    environment:
 | 
					 | 
				
			||||||
      PLUGIN_MIRROR:
 | 
					 | 
				
			||||||
        from_secret: plugin_mirror
 | 
					 | 
				
			||||||
      DOCKER_BUILDKIT: 1
 | 
					 | 
				
			||||||
    when:
 | 
					 | 
				
			||||||
      event:
 | 
					 | 
				
			||||||
        exclude:
 | 
					 | 
				
			||||||
        - pull_request
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  - name: publish-rootless
 | 
					 | 
				
			||||||
    image: plugins/docker:latest
 | 
					 | 
				
			||||||
    settings:
 | 
					 | 
				
			||||||
      dockerfile: Dockerfile.rootless
 | 
					 | 
				
			||||||
      auto_tag: false
 | 
					 | 
				
			||||||
      tags: ${DRONE_BRANCH##release/v}-nightly-linux-amd64-rootless
 | 
					 | 
				
			||||||
      repo: gitea/gitea
 | 
					 | 
				
			||||||
      build_args:
 | 
					 | 
				
			||||||
        - GOPROXY=https://goproxy.io
 | 
					 | 
				
			||||||
      password:
 | 
					 | 
				
			||||||
        from_secret: docker_password
 | 
					 | 
				
			||||||
      username:
 | 
					 | 
				
			||||||
        from_secret: docker_username
 | 
					 | 
				
			||||||
    environment:
 | 
					 | 
				
			||||||
      PLUGIN_MIRROR:
 | 
					 | 
				
			||||||
        from_secret: plugin_mirror
 | 
					 | 
				
			||||||
      DOCKER_BUILDKIT: 1
 | 
					 | 
				
			||||||
    when:
 | 
					 | 
				
			||||||
      event:
 | 
					 | 
				
			||||||
        exclude:
 | 
					 | 
				
			||||||
        - pull_request
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
---
 | 
					---
 | 
				
			||||||
kind: pipeline
 | 
					kind: pipeline
 | 
				
			||||||
type: docker
 | 
					type: docker
 | 
				
			||||||
@@ -506,136 +379,6 @@ steps:
 | 
				
			|||||||
        exclude:
 | 
					        exclude:
 | 
				
			||||||
        - pull_request
 | 
					        - pull_request
 | 
				
			||||||
 | 
					
 | 
				
			||||||
---
 | 
					 | 
				
			||||||
kind: pipeline
 | 
					 | 
				
			||||||
type: docker
 | 
					 | 
				
			||||||
name: docker-linux-arm64-release
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
platform:
 | 
					 | 
				
			||||||
  os: linux
 | 
					 | 
				
			||||||
  arch: arm64
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
trigger:
 | 
					 | 
				
			||||||
  ref:
 | 
					 | 
				
			||||||
  - refs/heads/main
 | 
					 | 
				
			||||||
  paths:
 | 
					 | 
				
			||||||
    exclude:
 | 
					 | 
				
			||||||
      - "docs/**"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
steps:
 | 
					 | 
				
			||||||
  - name: fetch-tags
 | 
					 | 
				
			||||||
    image: docker:git
 | 
					 | 
				
			||||||
    pull: always
 | 
					 | 
				
			||||||
    commands:
 | 
					 | 
				
			||||||
      - git fetch --tags --force
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  - name: publish
 | 
					 | 
				
			||||||
    image: plugins/docker:latest
 | 
					 | 
				
			||||||
    pull: always
 | 
					 | 
				
			||||||
    settings:
 | 
					 | 
				
			||||||
      auto_tag: false
 | 
					 | 
				
			||||||
      tags: nightly-linux-arm64
 | 
					 | 
				
			||||||
      repo: gitea/gitea
 | 
					 | 
				
			||||||
      build_args:
 | 
					 | 
				
			||||||
        - GOPROXY=https://goproxy.io
 | 
					 | 
				
			||||||
      password:
 | 
					 | 
				
			||||||
        from_secret: docker_password
 | 
					 | 
				
			||||||
      username:
 | 
					 | 
				
			||||||
        from_secret: docker_username
 | 
					 | 
				
			||||||
    environment:
 | 
					 | 
				
			||||||
      PLUGIN_MIRROR:
 | 
					 | 
				
			||||||
        from_secret: plugin_mirror
 | 
					 | 
				
			||||||
      DOCKER_BUILDKIT: 1
 | 
					 | 
				
			||||||
    when:
 | 
					 | 
				
			||||||
      event:
 | 
					 | 
				
			||||||
        exclude:
 | 
					 | 
				
			||||||
        - pull_request
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  - name: publish-rootless
 | 
					 | 
				
			||||||
    image: plugins/docker:latest
 | 
					 | 
				
			||||||
    settings:
 | 
					 | 
				
			||||||
      dockerfile: Dockerfile.rootless
 | 
					 | 
				
			||||||
      auto_tag: false
 | 
					 | 
				
			||||||
      tags: nightly-linux-arm64-rootless
 | 
					 | 
				
			||||||
      repo: gitea/gitea
 | 
					 | 
				
			||||||
      build_args:
 | 
					 | 
				
			||||||
        - GOPROXY=https://goproxy.io
 | 
					 | 
				
			||||||
      password:
 | 
					 | 
				
			||||||
        from_secret: docker_password
 | 
					 | 
				
			||||||
      username:
 | 
					 | 
				
			||||||
        from_secret: docker_username
 | 
					 | 
				
			||||||
    environment:
 | 
					 | 
				
			||||||
      PLUGIN_MIRROR:
 | 
					 | 
				
			||||||
        from_secret: plugin_mirror
 | 
					 | 
				
			||||||
      DOCKER_BUILDKIT: 1
 | 
					 | 
				
			||||||
    when:
 | 
					 | 
				
			||||||
      event:
 | 
					 | 
				
			||||||
        exclude:
 | 
					 | 
				
			||||||
        - pull_request
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
---
 | 
					 | 
				
			||||||
kind: pipeline
 | 
					 | 
				
			||||||
name: docker-linux-arm64-release-branch
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
platform:
 | 
					 | 
				
			||||||
  os: linux
 | 
					 | 
				
			||||||
  arch: arm64
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
trigger:
 | 
					 | 
				
			||||||
  ref:
 | 
					 | 
				
			||||||
  - "refs/heads/release/v*"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
steps:
 | 
					 | 
				
			||||||
  - name: fetch-tags
 | 
					 | 
				
			||||||
    image: docker:git
 | 
					 | 
				
			||||||
    pull: always
 | 
					 | 
				
			||||||
    commands:
 | 
					 | 
				
			||||||
      - git fetch --tags --force
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  - name: publish
 | 
					 | 
				
			||||||
    image: plugins/docker:latest
 | 
					 | 
				
			||||||
    pull: always
 | 
					 | 
				
			||||||
    settings:
 | 
					 | 
				
			||||||
      auto_tag: false
 | 
					 | 
				
			||||||
      tags: ${DRONE_BRANCH##release/v}-nightly-linux-arm64
 | 
					 | 
				
			||||||
      repo: gitea/gitea
 | 
					 | 
				
			||||||
      build_args:
 | 
					 | 
				
			||||||
        - GOPROXY=https://goproxy.io
 | 
					 | 
				
			||||||
      password:
 | 
					 | 
				
			||||||
        from_secret: docker_password
 | 
					 | 
				
			||||||
      username:
 | 
					 | 
				
			||||||
        from_secret: docker_username
 | 
					 | 
				
			||||||
    environment:
 | 
					 | 
				
			||||||
      PLUGIN_MIRROR:
 | 
					 | 
				
			||||||
        from_secret: plugin_mirror
 | 
					 | 
				
			||||||
      DOCKER_BUILDKIT: 1
 | 
					 | 
				
			||||||
    when:
 | 
					 | 
				
			||||||
      event:
 | 
					 | 
				
			||||||
        exclude:
 | 
					 | 
				
			||||||
        - pull_request
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  - name: publish-rootless
 | 
					 | 
				
			||||||
    image: plugins/docker:latest
 | 
					 | 
				
			||||||
    settings:
 | 
					 | 
				
			||||||
      dockerfile: Dockerfile.rootless
 | 
					 | 
				
			||||||
      auto_tag: false
 | 
					 | 
				
			||||||
      tags: ${DRONE_BRANCH##release/v}-nightly-linux-arm64-rootless
 | 
					 | 
				
			||||||
      repo: gitea/gitea
 | 
					 | 
				
			||||||
      build_args:
 | 
					 | 
				
			||||||
        - GOPROXY=https://goproxy.io
 | 
					 | 
				
			||||||
      password:
 | 
					 | 
				
			||||||
        from_secret: docker_password
 | 
					 | 
				
			||||||
      username:
 | 
					 | 
				
			||||||
        from_secret: docker_username
 | 
					 | 
				
			||||||
    environment:
 | 
					 | 
				
			||||||
      PLUGIN_MIRROR:
 | 
					 | 
				
			||||||
        from_secret: plugin_mirror
 | 
					 | 
				
			||||||
      DOCKER_BUILDKIT: 1
 | 
					 | 
				
			||||||
    when:
 | 
					 | 
				
			||||||
      event:
 | 
					 | 
				
			||||||
        exclude:
 | 
					 | 
				
			||||||
        - pull_request
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
---
 | 
					---
 | 
				
			||||||
kind: pipeline
 | 
					kind: pipeline
 | 
				
			||||||
type: docker
 | 
					type: docker
 | 
				
			||||||
@@ -681,50 +424,3 @@ depends_on:
 | 
				
			|||||||
  - docker-linux-amd64-release-candidate-version
 | 
					  - docker-linux-amd64-release-candidate-version
 | 
				
			||||||
  - docker-linux-arm64-release-version
 | 
					  - docker-linux-arm64-release-version
 | 
				
			||||||
  - docker-linux-arm64-release-candidate-version
 | 
					  - docker-linux-arm64-release-candidate-version
 | 
				
			||||||
 | 
					 | 
				
			||||||
---
 | 
					 | 
				
			||||||
kind: pipeline
 | 
					 | 
				
			||||||
type: docker
 | 
					 | 
				
			||||||
name: docker-manifest
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
platform:
 | 
					 | 
				
			||||||
  os: linux
 | 
					 | 
				
			||||||
  arch: amd64
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
steps:
 | 
					 | 
				
			||||||
  - name: manifest-rootless
 | 
					 | 
				
			||||||
    image: plugins/manifest
 | 
					 | 
				
			||||||
    pull: always
 | 
					 | 
				
			||||||
    settings:
 | 
					 | 
				
			||||||
      auto_tag: false
 | 
					 | 
				
			||||||
      ignore_missing: true
 | 
					 | 
				
			||||||
      spec: docker/manifest.rootless.tmpl
 | 
					 | 
				
			||||||
      password:
 | 
					 | 
				
			||||||
        from_secret: docker_password
 | 
					 | 
				
			||||||
      username:
 | 
					 | 
				
			||||||
        from_secret: docker_username
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  - name: manifest
 | 
					 | 
				
			||||||
    image: plugins/manifest
 | 
					 | 
				
			||||||
    settings:
 | 
					 | 
				
			||||||
      auto_tag: false
 | 
					 | 
				
			||||||
      ignore_missing: true
 | 
					 | 
				
			||||||
      spec: docker/manifest.tmpl
 | 
					 | 
				
			||||||
      password:
 | 
					 | 
				
			||||||
        from_secret: docker_password
 | 
					 | 
				
			||||||
      username:
 | 
					 | 
				
			||||||
        from_secret: docker_username
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
trigger:
 | 
					 | 
				
			||||||
  ref:
 | 
					 | 
				
			||||||
  - refs/heads/main
 | 
					 | 
				
			||||||
  - "refs/heads/release/v*"
 | 
					 | 
				
			||||||
  paths:
 | 
					 | 
				
			||||||
    exclude:
 | 
					 | 
				
			||||||
      - "docs/**"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
depends_on:
 | 
					 | 
				
			||||||
  - docker-linux-amd64-release
 | 
					 | 
				
			||||||
  - docker-linux-arm64-release
 | 
					 | 
				
			||||||
  - docker-linux-amd64-release-branch
 | 
					 | 
				
			||||||
  - docker-linux-arm64-release-branch
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										32
									
								
								.github/workflows/release-nightly.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										32
									
								
								.github/workflows/release-nightly.yml
									
									
									
									
										vendored
									
									
								
							@@ -55,5 +55,33 @@ jobs:
 | 
				
			|||||||
    runs-on: ubuntu-latest
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
    steps:
 | 
					    steps:
 | 
				
			||||||
      - uses: actions/checkout@v3
 | 
					      - uses: actions/checkout@v3
 | 
				
			||||||
      - uses: docker/setup-buildx-action@v1
 | 
					      - uses: docker/setup-qemu-action@v2
 | 
				
			||||||
      # build for linux/amd64, and linux/arm64 (possibly include linux/arm/v7 later. not included now because it adds significant amount to the build time)
 | 
					      - uses: docker/setup-buildx-action@v2
 | 
				
			||||||
 | 
					      - name: Get cleaned branch name
 | 
				
			||||||
 | 
					        id: clean_name
 | 
				
			||||||
 | 
					        run: |
 | 
				
			||||||
 | 
					          # if main then say nightly otherwise cleanup name
 | 
				
			||||||
 | 
					          if [ "${{ github.ref }}" = "refs/heads/main" ]; then
 | 
				
			||||||
 | 
					            echo "branch=nightly" >> "$GITHUB_OUTPUT"
 | 
				
			||||||
 | 
					            exit 0
 | 
				
			||||||
 | 
					          fi
 | 
				
			||||||
 | 
					          REF_NAME=$(echo "${{ github.ref }}" | sed -e 's/refs\/heads\///' -e 's/refs\/tags\///' -e 's/release\/v//')
 | 
				
			||||||
 | 
					          echo "branch=${REF_NAME}-nightly" >> "$GITHUB_OUTPUT"
 | 
				
			||||||
 | 
					      - name: Login to Docker Hub
 | 
				
			||||||
 | 
					        uses: docker/login-action@v2
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          username: ${{ secrets.DOCKERHUB_USERNAME }}
 | 
				
			||||||
 | 
					          password: ${{ secrets.DOCKERHUB_TOKEN }}
 | 
				
			||||||
 | 
					      - name: build rootful docker image
 | 
				
			||||||
 | 
					        uses: docker/build-push-action@v4
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          platforms: linux/amd64,linux/arm64
 | 
				
			||||||
 | 
					          push: true
 | 
				
			||||||
 | 
					          tags: gitea/gitea:${{ steps.clean_name.outputs.branch }}
 | 
				
			||||||
 | 
					      - name: build rootless docker image
 | 
				
			||||||
 | 
					        uses: docker/build-push-action@v4
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          platforms: linux/amd64,linux/arm64
 | 
				
			||||||
 | 
					          push: true
 | 
				
			||||||
 | 
					          file: Dockerfile.rootless
 | 
				
			||||||
 | 
					          tags: gitea/gitea:${{ steps.clean_name.outputs.branch }}-rootless
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user