From 439fcfa5caa8fb6561fe73951d060a4cccf5d137 Mon Sep 17 00:00:00 2001 From: miragecentury Date: Tue, 12 Dec 2023 21:52:38 +0100 Subject: [PATCH 1/5] ci: rename lint to test-and-build and wip build jobs --- .github/workflows/lint.yaml | 36 --------------- .github/workflows/test-and-build.yaml | 64 +++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 36 deletions(-) delete mode 100644 .github/workflows/lint.yaml create mode 100644 .github/workflows/test-and-build.yaml diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml deleted file mode 100644 index 3a2d3ce..0000000 --- a/.github/workflows/lint.yaml +++ /dev/null @@ -1,36 +0,0 @@ -name: docker-image-lint - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -jobs: - hadolint: - name: HadoLint - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: hadolint/hadolint-action@v3.1.0 - name: hadolint - with: - dockerfile: src/Dockerfile - - name: Update Pull Request - uses: actions/github-script@v6 - if: github.event_name == 'pull_request' - with: - script: | - const output = ` - #### Hadolint: \`${{ steps.hadolint.outcome }}\` - \`\`\` - ${process.env.HADOLINT_RESULTS} - \`\`\` - `; - - github.rest.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: output - }) \ No newline at end of file diff --git a/.github/workflows/test-and-build.yaml b/.github/workflows/test-and-build.yaml new file mode 100644 index 0000000..350ec7c --- /dev/null +++ b/.github/workflows/test-and-build.yaml @@ -0,0 +1,64 @@ +name: docker-image + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + hadolint: + name: HadoLint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: hadolint/hadolint-action@v3.1.0 + name: hadolint + with: + dockerfile: src/Dockerfile + - name: Update Pull Request + uses: actions/github-script@v6 + if: github.event_name == 'pull_request' + with: + script: | + const output = ` + #### Hadolint: \`${{ steps.hadolint.outcome }}\` + \`\`\` + ${process.env.HADOLINT_RESULTS} + \`\`\` + `; + + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: output + }) + build: + name: Docker Build + strategy: + matrix: + os: [ubuntu-latest] + arch: [x64, arm64] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + - name: Set up QEMU for crossplatform builds + uses: docker/setup-qemu-action@v3 + with: + platforms: ${{ matrix.arch }} + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to DockerHub + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push + uses: docker/build-push-action@v5 + with: + push: true + tags: ghcr.io/DeerHide/docker_github_runner:${{ github.sha }} + build-args: | + ARCH=${{ matrix.arch }} \ No newline at end of file From c7f20603e7c9643ad5bbdcf634034d9df7124816 Mon Sep 17 00:00:00 2001 From: miragecentury Date: Tue, 12 Dec 2023 21:54:40 +0100 Subject: [PATCH 2/5] fix: ci namespace to lowercase --- .github/workflows/test-and-build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-and-build.yaml b/.github/workflows/test-and-build.yaml index 350ec7c..2c76802 100644 --- a/.github/workflows/test-and-build.yaml +++ b/.github/workflows/test-and-build.yaml @@ -59,6 +59,6 @@ jobs: uses: docker/build-push-action@v5 with: push: true - tags: ghcr.io/DeerHide/docker_github_runner:${{ github.sha }} + tags: ghcr.io/deerhide/docker_github_runner:${{ github.sha }} build-args: | ARCH=${{ matrix.arch }} \ No newline at end of file From 70544027289bd2206ca1442b0319604038c276b4 Mon Sep 17 00:00:00 2001 From: miragecentury Date: Tue, 12 Dec 2023 21:56:17 +0100 Subject: [PATCH 3/5] ci: add context src to build push --- .github/workflows/test-and-build.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-and-build.yaml b/.github/workflows/test-and-build.yaml index 2c76802..3417205 100644 --- a/.github/workflows/test-and-build.yaml +++ b/.github/workflows/test-and-build.yaml @@ -58,6 +58,7 @@ jobs: - name: Build and push uses: docker/build-push-action@v5 with: + context: src push: true tags: ghcr.io/deerhide/docker_github_runner:${{ github.sha }} build-args: | From 57044f629f12ebdcbea5f0eb156ce7bd9eaadf24 Mon Sep 17 00:00:00 2001 From: MirageCentury Date: Wed, 13 Dec 2023 21:16:39 +0100 Subject: [PATCH 4/5] feat: add platform on docker/build-push --- .github/workflows/test-and-build.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-and-build.yaml b/.github/workflows/test-and-build.yaml index 3417205..844f78c 100644 --- a/.github/workflows/test-and-build.yaml +++ b/.github/workflows/test-and-build.yaml @@ -8,7 +8,7 @@ on: jobs: hadolint: - name: HadoLint + name: lint-hadolint runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -24,7 +24,7 @@ jobs: const output = ` #### Hadolint: \`${{ steps.hadolint.outcome }}\` \`\`\` - ${process.env.HADOLINT_RESULTS} + ${ process.env.HADOLINT_RESULTS } \`\`\` `; @@ -61,5 +61,6 @@ jobs: context: src push: true tags: ghcr.io/deerhide/docker_github_runner:${{ github.sha }} + platforms: linux/${{ matrix.arch }} build-args: | ARCH=${{ matrix.arch }} \ No newline at end of file From b18cba7c5dfdac5de27ec91ee3901486cb900dec Mon Sep 17 00:00:00 2001 From: MirageCentury Date: Wed, 13 Dec 2023 21:21:42 +0100 Subject: [PATCH 5/5] fix: achitecture name x64 -> amd64 --- .github/workflows/test-and-build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-and-build.yaml b/.github/workflows/test-and-build.yaml index 844f78c..683214c 100644 --- a/.github/workflows/test-and-build.yaml +++ b/.github/workflows/test-and-build.yaml @@ -39,7 +39,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - arch: [x64, arm64] + arch: [amd64, arm64] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4