From dbf3fe7563791238fb19a866d908d7755a2a501a Mon Sep 17 00:00:00 2001 From: qfdk Date: Thu, 11 May 2023 18:30:01 +0200 Subject: [PATCH 1/6] Create docker-image.yml --- .github/workflows/docker-image.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/docker-image.yml diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 0000000..37a2b80 --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,18 @@ +name: Docker Image CI + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Build the Docker image + run: docker build . --file Dockerfile -t qfdk/easydockerweb --platform=linux/arm,linux/arm64,linux/amd64 From f8e414d9a270a2718c3fdb881746f1e7c28f2f97 Mon Sep 17 00:00:00 2001 From: qfdk Date: Thu, 11 May 2023 18:33:22 +0200 Subject: [PATCH 2/6] Update docker-image.yml --- .github/workflows/docker-image.yml | 45 ++++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 11 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 37a2b80..56f4919 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -1,18 +1,41 @@ -name: Docker Image CI +name: build_docker on: push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] + branches: [master] + release: + types: [created] # 表示在创建新的 Release 时触发 jobs: - - build: - + build_docker: + name: Build docker runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Build the Docker image - run: docker build . --file Dockerfile -t qfdk/easydockerweb --platform=linux/arm,linux/arm64,linux/amd64 + - name: Checkout + uses: actions/checkout@v3 + + - run: | + echo "本次构建的版本为:${GITHUB_REF_NAME} (但是这个变量目前上下文中无法获取到)" + echo 本次构建的版本为:${{ github.ref_name }} + env + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Build and push + id: docker_build + uses: docker/build-push-action@v4 + with: + context: . + push: true + labels: ${{ steps.meta.outputs.labels }} + platforms: linux/amd64,linux/arm64 + tags: | + ${{ secrets.DOCKERHUB_USERNAME }}/easydockerweb:${{ github.ref_name }} + ${{ secrets.DOCKERHUB_USERNAME }}/easydockerweb:latest From c2f362c6e10da6fcceee3ab3979d64e2b825cc7b Mon Sep 17 00:00:00 2001 From: qfdk Date: Thu, 11 May 2023 18:52:39 +0200 Subject: [PATCH 3/6] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 10997a2..39892eb 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,7 @@ docker run -p 3000:3000 -v /var/run/docker.sock:/var/run/docker.sock easy-docker - 系统状态查看 - 镜像获取 - 计划使用react重构 https://github.com/qfdk/EasyDockerWeb/tree/react +- 添加git actions ## Images ![login](./images/login.png) From c14d18fadfccddcbe71171f5ef8601e6996541f5 Mon Sep 17 00:00:00 2001 From: qfdk Date: Thu, 11 May 2023 18:54:57 +0200 Subject: [PATCH 4/6] Update docker-image.yml From d5878388ae77a2cc39d9e7cb0898fd52e58e9db5 Mon Sep 17 00:00:00 2001 From: qfdk Date: Thu, 11 May 2023 18:58:50 +0200 Subject: [PATCH 5/6] Update docker-image.yml --- .github/workflows/docker-image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 56f4919..98b7d88 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -24,7 +24,7 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - name: Login to DockerHub - uses: docker/login-action@v2 + uses: docker/login-action@v1 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} From 840d00aead2e3eb576e60ef7d6de965e6e9d2d14 Mon Sep 17 00:00:00 2001 From: qfdk Date: Thu, 11 May 2023 19:00:38 +0200 Subject: [PATCH 6/6] Update docker-image.yml --- .github/workflows/docker-image.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 98b7d88..ba21e51 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -16,7 +16,7 @@ jobs: - run: | echo "本次构建的版本为:${GITHUB_REF_NAME} (但是这个变量目前上下文中无法获取到)" - echo 本次构建的版本为:${{ github.ref_name }} + echo 本次构建的版本为:${{ github.ref_name }} ${{ secrets.DOCKERHUB_USERNAME }} env - name: Set up QEMU @@ -24,7 +24,7 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - name: Login to DockerHub - uses: docker/login-action@v1 + uses: docker/login-action@v2 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }}