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..683214c --- /dev/null +++ b/.github/workflows/test-and-build.yaml @@ -0,0 +1,66 @@ +name: docker-image + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + hadolint: + name: lint-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: [amd64, 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: + 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