From d50b28459e2924f1253f9a554d6ce79c03b8baa2 Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Sat, 12 Oct 2024 12:34:07 +0200 Subject: [PATCH] feat: build httpbox docker image --- .github/workflows/build-and-push.yml | 54 ++++++++++++++++++++++++++-- Dockerfile_chatterino2-test-httpbox | 5 +++ 2 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 Dockerfile_chatterino2-test-httpbox diff --git a/.github/workflows/build-and-push.yml b/.github/workflows/build-and-push.yml index a5aecfc..857a709 100644 --- a/.github/workflows/build-and-push.yml +++ b/.github/workflows/build-and-push.yml @@ -17,8 +17,8 @@ env: REGISTRY: ghcr.io jobs: - build: - name: "Build ${{ matrix.image-name }}" + build-c2-build: + name: "Build ${{ matrix.image-name }} builder" runs-on: ubuntu-latest strategy: matrix: @@ -88,3 +88,53 @@ jobs: file: ./chatterino-docker/Dockerfile_${{ matrix.image-name }} cache-from: type=registry,ref=${{ env.IMAGE_NAME }} cache-to: type=inline + + build-c2-generic: + name: "Build ${{ matrix.image-name }} generic" + runs-on: ubuntu-latest + strategy: + matrix: + include: + # The Dockerfile file name will be inferred from the image-name parameter + # If the image-name is chatterino2-xd, the Dockerfile it will look for is Dockerfile_chatterino2-xd + - image-name: chatterino2-test-httpbox + env: + IMAGE_NAME: "chatterino/${{ matrix.image-name }}" + + steps: + - uses: actions/checkout@v4 + with: + path: "chatterino-docker" + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log into docker registry + if: github.event_name == 'push' + uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build docker image + uses: docker/build-push-action@v5 + with: + context: . + push: false + load: true + tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + file: ./chatterino-docker/Dockerfile_${{ matrix.image-name }} + cache-from: type=registry,ref=${{ env.IMAGE_NAME }} + cache-to: type=inline + + - name: Push docker image + if: github.event_name == 'push' + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + file: ./chatterino-docker/Dockerfile_${{ matrix.image-name }} + cache-from: type=registry,ref=${{ env.IMAGE_NAME }} + cache-to: type=inline diff --git a/Dockerfile_chatterino2-test-httpbox b/Dockerfile_chatterino2-test-httpbox new file mode 100644 index 0000000..a00ce6a --- /dev/null +++ b/Dockerfile_chatterino2-test-httpbox @@ -0,0 +1,5 @@ +FROM rust:slim + +RUN cargo install --git https://github.com/kevinastone/httpbox --rev 6f0255effaea4fafa5c19c0a53725474b1a63577 + +ENTRYPOINT ["/usr/local/cargo/bin/httpbox"]