From 19895d5f7207a90325fa6a5dc924190ad23d851b Mon Sep 17 00:00:00 2001 From: suika <2320837+Suika@users.noreply.github.com> Date: Wed, 12 May 2021 04:26:31 +0200 Subject: [PATCH 1/3] Container build actions initial brainless copy of docker hub config to github actions --- .github/workflows/container_latest.yml | 115 +++++++++++++++++++++++ .github/workflows/container_release.yml | 118 ++++++++++++++++++++++++ 2 files changed, 233 insertions(+) create mode 100644 .github/workflows/container_latest.yml create mode 100644 .github/workflows/container_release.yml diff --git a/.github/workflows/container_latest.yml b/.github/workflows/container_latest.yml new file mode 100644 index 000000000..aacb52d29 --- /dev/null +++ b/.github/workflows/container_latest.yml @@ -0,0 +1,115 @@ +name: Build Latest Containers +on: + push: + branches: + - gh-container-build + workflow_dispatch: [] + +jobs: + build-latest: + runs-on: [ubuntu-latest] + steps: + - + name: Checkout + uses: actions/checkout@v2 + - + name: Docker meta + id: docker_meta + uses: crazy-max/ghaction-docker-meta@v2 + with: + images: | + chrislusf/seaweedfs + ghcr.io/chrislusf/seaweedfs + tags: | + type=raw,value=latest + labels: | + org.opencontainers.image.title=seaweedfs + org.opencontainers.image.description=SeaweedFS is a distributed storage system for blobs, objects, files, and data lake, to store and serve billions of files fast! + org.opencontainers.image.vendor=Chris Lu + - + name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + with: + buildkitd-flags: "--debug" + - + name: Login to Docker Hub + if: false + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - + name: Login to GHCR + if: false + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ secrets.GHCR_USERNAME }} + password: ${{ secrets.GHCR_TOKEN }} + - + name: Build + uses: docker/build-push-action@v2 + with: + context: . + push: false + file: ./docker/Dockerfile + platforms: linux/amd64 + tags: ${{ steps.docker_meta.outputs.tags }} + labels: ${{ steps.docker_meta.outputs.labels }} + + build-dev: + runs-on: [ubuntu-latest] + steps: + - + name: Checkout + uses: actions/checkout@v2 + - + name: Docker meta + id: docker_meta + uses: crazy-max/ghaction-docker-meta@v2 + with: + images: | + chrislusf/seaweedfs + ghcr.io/chrislusf/seaweedfs + tags: | + type=raw,value=dev + labels: | + org.opencontainers.image.title=seaweedfs + org.opencontainers.image.description=SeaweedFS is a distributed storage system for blobs, objects, files, and data lake, to store and serve billions of files fast! + org.opencontainers.image.vendor=Chris Lu + - + name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + with: + buildkitd-flags: "--debug" + - + name: Login to Docker Hub + if: false + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - + name: Login to GHCR + if: false + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ secrets.GHCR_USERNAME }} + password: ${{ secrets.GHCR_TOKEN }} + - + name: Build + uses: docker/build-push-action@v2 + with: + context: ./docker + push: false + file: ./docker/Dockerfile.go_build + platforms: linux/amd64 + tags: ${{ steps.docker_meta.outputs.tags }} + labels: ${{ steps.docker_meta.outputs.labels }} diff --git a/.github/workflows/container_release.yml b/.github/workflows/container_release.yml new file mode 100644 index 000000000..d86b1d1ea --- /dev/null +++ b/.github/workflows/container_release.yml @@ -0,0 +1,118 @@ +name: Build Release Containers +on: + push: + tags: + - '*' + workflow_dispatch: [] + +jobs: + build-default: + runs-on: [ubuntu-latest] + steps: + - + name: Checkout + uses: actions/checkout@v2 + - + name: Docker meta + id: docker_meta + uses: crazy-max/ghaction-docker-meta@v2 + with: + images: | + chrislusf/seaweedfs + ghcr.io/chrislusf/seaweedfs + tags: | + type=ref,event=tag + flavor: | + latest=false + labels: | + org.opencontainers.image.title=seaweedfs + org.opencontainers.image.description=SeaweedFS is a distributed storage system for blobs, objects, files, and data lake, to store and serve billions of files fast! + org.opencontainers.image.vendor=Chris Lu + - + name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + with: + buildkitd-flags: "--debug" + - + name: Login to Docker Hub + if: false + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - + name: Login to GHCR + if: false + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ secrets.GHCR_USERNAME }} + password: ${{ secrets.GHCR_TOKEN }} + - + name: Build + uses: docker/build-push-action@v2 + with: + context: ./docker + push: false + file: ./docker/Dockerfile.go_build + platforms: linux/amd64 + tags: ${{ steps.docker_meta.outputs.tags }} + labels: ${{ steps.docker_meta.outputs.labels }} + build-large: + runs-on: [ubuntu-latest] + steps: + - + name: Checkout + uses: actions/checkout@v2 + - + name: Docker meta + id: docker_meta + uses: crazy-max/ghaction-docker-meta@v2 + with: + images: | + chrislusf/seaweedfs + ghcr.io/chrislusf/seaweedfs + tags: | + type=ref,event=tag,suffix=_large_disk + flavor: | + latest=false + labels: | + org.opencontainers.image.title=seaweedfs + org.opencontainers.image.description=SeaweedFS is a distributed storage system for blobs, objects, files, and data lake, to store and serve billions of files fast! + org.opencontainers.image.vendor=Chris Lu + - + name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + with: + buildkitd-flags: "--debug" + - + name: Login to Docker Hub + if: false + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - + name: Login to GHCR + if: false + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ secrets.GHCR_USERNAME }} + password: ${{ secrets.GHCR_TOKEN }} + - + name: Build + uses: docker/build-push-action@v2 + with: + context: ./docker + push: false + file: ./docker/Dockerfile.go_build_large + platforms: linux/amd64 + tags: ${{ steps.docker_meta.outputs.tags }} + labels: ${{ steps.docker_meta.outputs.labels }} From 727287a755bad6c40cca56ee9c5f985d49898a08 Mon Sep 17 00:00:00 2001 From: suika <2320837+Suika@users.noreply.github.com> Date: Wed, 12 May 2021 04:31:13 +0200 Subject: [PATCH 2/3] Fix build context for latest tag --- .github/workflows/container_latest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/container_latest.yml b/.github/workflows/container_latest.yml index aacb52d29..f7bc4d353 100644 --- a/.github/workflows/container_latest.yml +++ b/.github/workflows/container_latest.yml @@ -53,7 +53,7 @@ jobs: name: Build uses: docker/build-push-action@v2 with: - context: . + context: ./docker push: false file: ./docker/Dockerfile platforms: linux/amd64 From 285a4667c2a0c642a902fbb870d0591b574f7a81 Mon Sep 17 00:00:00 2001 From: suika <2320837+Suika@users.noreply.github.com> Date: Wed, 12 May 2021 04:38:36 +0200 Subject: [PATCH 3/3] Enable login/push, build latest/dev on master branch Login to Docker Hub and Github Container Repo is enabled, need the secrets to be set. Remove ...image.description because it wil be automatically set. --- .github/workflows/container_latest.yml | 15 +++++++-------- .github/workflows/container_release.yml | 12 ++++++------ 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/.github/workflows/container_latest.yml b/.github/workflows/container_latest.yml index f7bc4d353..e4b3c2a38 100644 --- a/.github/workflows/container_latest.yml +++ b/.github/workflows/container_latest.yml @@ -2,7 +2,7 @@ name: Build Latest Containers on: push: branches: - - gh-container-build + - master workflow_dispatch: [] jobs: @@ -24,7 +24,6 @@ jobs: type=raw,value=latest labels: | org.opencontainers.image.title=seaweedfs - org.opencontainers.image.description=SeaweedFS is a distributed storage system for blobs, objects, files, and data lake, to store and serve billions of files fast! org.opencontainers.image.vendor=Chris Lu - name: Set up QEMU @@ -36,14 +35,14 @@ jobs: buildkitd-flags: "--debug" - name: Login to Docker Hub - if: false + if: github.event_name != 'pull_request' uses: docker/login-action@v1 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: Login to GHCR - if: false + if: github.event_name != 'pull_request' uses: docker/login-action@v1 with: registry: ghcr.io @@ -54,7 +53,7 @@ jobs: uses: docker/build-push-action@v2 with: context: ./docker - push: false + push: ${{ github.event_name != 'pull_request' }} file: ./docker/Dockerfile platforms: linux/amd64 tags: ${{ steps.docker_meta.outputs.tags }} @@ -90,14 +89,14 @@ jobs: buildkitd-flags: "--debug" - name: Login to Docker Hub - if: false + if: github.event_name != 'pull_request' uses: docker/login-action@v1 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: Login to GHCR - if: false + if: github.event_name != 'pull_request' uses: docker/login-action@v1 with: registry: ghcr.io @@ -108,7 +107,7 @@ jobs: uses: docker/build-push-action@v2 with: context: ./docker - push: false + push: ${{ github.event_name != 'pull_request' }} file: ./docker/Dockerfile.go_build platforms: linux/amd64 tags: ${{ steps.docker_meta.outputs.tags }} diff --git a/.github/workflows/container_release.yml b/.github/workflows/container_release.yml index d86b1d1ea..1ade0878e 100644 --- a/.github/workflows/container_release.yml +++ b/.github/workflows/container_release.yml @@ -38,14 +38,14 @@ jobs: buildkitd-flags: "--debug" - name: Login to Docker Hub - if: false + if: github.event_name != 'pull_request' uses: docker/login-action@v1 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: Login to GHCR - if: false + if: github.event_name != 'pull_request' uses: docker/login-action@v1 with: registry: ghcr.io @@ -56,7 +56,7 @@ jobs: uses: docker/build-push-action@v2 with: context: ./docker - push: false + push: ${{ github.event_name != 'pull_request' }} file: ./docker/Dockerfile.go_build platforms: linux/amd64 tags: ${{ steps.docker_meta.outputs.tags }} @@ -93,14 +93,14 @@ jobs: buildkitd-flags: "--debug" - name: Login to Docker Hub - if: false + if: github.event_name != 'pull_request' uses: docker/login-action@v1 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: Login to GHCR - if: false + if: github.event_name != 'pull_request' uses: docker/login-action@v1 with: registry: ghcr.io @@ -111,7 +111,7 @@ jobs: uses: docker/build-push-action@v2 with: context: ./docker - push: false + push: ${{ github.event_name != 'pull_request' }} file: ./docker/Dockerfile.go_build_large platforms: linux/amd64 tags: ${{ steps.docker_meta.outputs.tags }}