From b7c184060984a134dae4035c2c2e259a1b861b4e Mon Sep 17 00:00:00 2001 From: Evandro Pomatti Date: Sat, 16 Dec 2023 18:22:00 -0300 Subject: [PATCH] arm64 --- .github/workflows/docker-publish.yml | 2 +- .github/workflows/dockerhub-arm64.yml | 31 +++++++++++++++++++++++++++ .github/workflows/go.yml | 6 +++--- Dockerfile | 2 ++ Dockerfile.arm64v8 | 17 +++++++++++++++ README.md | 6 ++++++ 6 files changed, 60 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/dockerhub-arm64.yml create mode 100644 Dockerfile.arm64v8 diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index c5fca3a..639e994 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -30,7 +30,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Install the cosign tool except on PR # https://github.com/sigstore/cosign-installer diff --git a/.github/workflows/dockerhub-arm64.yml b/.github/workflows/dockerhub-arm64.yml new file mode 100644 index 0000000..6eeb565 --- /dev/null +++ b/.github/workflows/dockerhub-arm64.yml @@ -0,0 +1,31 @@ +name: Dockerhub ARM64 + +on: + workflow_dispatch: + +env: + REPOSITORY: stressbox:arm64 + +jobs: + + build: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./app + steps: + - uses: docker/setup-qemu-action@v3 + with: + platforms: 'arm64,arm' + - uses: actions/checkout@v4 + - name: Build the Docker image + run: docker build . --file Dockerfile.arm64v8 --tag $REPOSITORY + + - uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - run: | + docker tag $REPOSITORY epomatti/$REPOSITORY + docker push epomatti/$REPOSITORY \ No newline at end of file diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 042b83d..4b7f865 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -14,12 +14,12 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Go - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: - go-version: '1.21' + go-version: '1.21.5' - name: Build run: go build -v ./... diff --git a/Dockerfile b/Dockerfile index 7c86e81..01f72c0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,5 @@ + + FROM golang:1.21-alpine AS builder WORKDIR /build diff --git a/Dockerfile.arm64v8 b/Dockerfile.arm64v8 new file mode 100644 index 0000000..9dbac29 --- /dev/null +++ b/Dockerfile.arm64v8 @@ -0,0 +1,17 @@ +# https://github.com/golang/go/wiki/GoArm +# https://hub.docker.com/r/arm64v8/alpine/tags +FROM arm64v8/golang:1.21-alpine AS builder + +WORKDIR /build +COPY . . +RUN go mod download +RUN go build . + +FROM arm64v8/golang:1.21-alpine + +# curl added only for health check if anyone needs it +RUN apk update && apk add curl +WORKDIR /app +COPY --from=builder /build/stressbox . + +ENTRYPOINT ["/app/stressbox"] \ No newline at end of file diff --git a/README.md b/README.md index d9f6d85..f86b895 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,12 @@ Pull the image: docker pull ghcr.io/epomatti/stressbox ``` +An `ARM64` release is now available on Docker Hub: + +```sh +docker pull epomatti/stressbox:arm64 +``` + Start the container: > 💡 Add `-e port=` to start the listener in another port