From a831fd5560795bfc512041470e23e11bd4ea2ac0 Mon Sep 17 00:00:00 2001 From: Pascal Canadas Date: Fri, 29 Sep 2023 10:53:59 +0200 Subject: [PATCH 1/4] =?UTF-8?q?=F0=9F=93=A6=20NEW:=20Add=20Docker=20compil?= =?UTF-8?q?ation=20bu=20CI/CD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/docker.yml | 51 ++++++++++++++++++++++++++++++++++++ Dockerfile | 1 + 2 files changed, 52 insertions(+) create mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 00000000..3cd676ad --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,51 @@ +name: Publication Docker image + +on: [push] + +jobs: + docker: + runs-on: ubuntu-latest + strategy: + matrix: + architecture: [linux/amd64, linux/aarch64] + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Login Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + with: + platforms: all + version: latest + - name: Setup Docker Buildx + uses: docker/setup-buildx-action@v1 + id: buildx + with: + install: true + version: latest + use: true + - name: Cache Docker Image Layers + uses: actions/cache@v2 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + - name: Build and Push Docker Image + uses: docker/build-push-action@v2 + id: docker_build + with: + context: ./ + file: ./Dockerfile + builder: ${{ steps.buildx.outputs.name }} + platforms: ${{ matrix.architecture }} + push: true + tags: ${{ secrets.DOCKER_USERNAME }}/imaginaryprototype:latest + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache,mode=max + - name: Verify + run: echo ${{ steps.docker_build.outputs.digest }} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 67c699be..65dff2f9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -50,6 +50,7 @@ RUN go mod download COPY . . # Run quality control +# RUN go test ./... -test.v -test.coverprofile=atomic . RUN go test ./... -test.v -race -test.coverprofile=atomic . RUN golangci-lint run . From 083efa66dda2161f33dd7be49bdf87d224c1f086 Mon Sep 17 00:00:00 2001 From: Pascal Canadas Date: Fri, 29 Sep 2023 11:01:11 +0200 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=90=9B=20FIX:=20Delete=20params=20-ra?= =?UTF-8?q?ce=20(imp.=20with=20github=20action)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 65dff2f9..983964d6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -50,8 +50,8 @@ RUN go mod download COPY . . # Run quality control -# RUN go test ./... -test.v -test.coverprofile=atomic . -RUN go test ./... -test.v -race -test.coverprofile=atomic . +# RUN go test ./... -test.v -race -test.coverprofile=atomic . +RUN go test ./... -test.v -test.coverprofile=atomic . RUN golangci-lint run . # Compile imaginary From e7a60ccf9808d70e94a4aa0f84661fd142c0b779 Mon Sep 17 00:00:00 2001 From: Pascal Canadas Date: Fri, 29 Sep 2023 11:25:49 +0200 Subject: [PATCH 3/4] =?UTF-8?q?=F0=9F=90=9B=20FIX:=20Prototype=20aarch64?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/docker.yml | 2 +- Dockerfile | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 3cd676ad..a8693736 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - architecture: [linux/amd64, linux/aarch64] + architecture: [linux/amd64, linux/arm64, linux/aarch64] steps: - name: Checkout uses: actions/checkout@v4 diff --git a/Dockerfile b/Dockerfile index 983964d6..07d4a01e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -51,7 +51,8 @@ COPY . . # Run quality control # RUN go test ./... -test.v -race -test.coverprofile=atomic . -RUN go test ./... -test.v -test.coverprofile=atomic . +ARG TARGETPLATFORM +RUN if [ "$TARGETPLATFORM" = "linux/arm64" ] ; then go test ./... -test.v -test.coverprofile=atomic . ; else go test ./... -test.v -race -test.coverprofile=atomic . ; fi RUN golangci-lint run . # Compile imaginary From 09012b7bf6ea81cd38d33362976527f813479f07 Mon Sep 17 00:00:00 2001 From: Pascal Canadas Date: Fri, 29 Sep 2023 14:19:15 +0200 Subject: [PATCH 4/4] =?UTF-8?q?=F0=9F=90=9B=20FIX:=20Correction=20finale?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/docker.yml | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index a8693736..1686e399 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -5,9 +5,6 @@ on: [push] jobs: docker: runs-on: ubuntu-latest - strategy: - matrix: - architecture: [linux/amd64, linux/arm64, linux/aarch64] steps: - name: Checkout uses: actions/checkout@v4 @@ -20,14 +17,9 @@ jobs: uses: docker/setup-qemu-action@v3 with: platforms: all - version: latest - name: Setup Docker Buildx uses: docker/setup-buildx-action@v1 id: buildx - with: - install: true - version: latest - use: true - name: Cache Docker Image Layers uses: actions/cache@v2 with: @@ -42,7 +34,7 @@ jobs: context: ./ file: ./Dockerfile builder: ${{ steps.buildx.outputs.name }} - platforms: ${{ matrix.architecture }} + platforms: linux/amd64, linux/arm64, linux/aarch64 push: true tags: ${{ secrets.DOCKER_USERNAME }}/imaginaryprototype:latest cache-from: type=local,src=/tmp/.buildx-cache