From 260b5d12578d4c183b5ce48c02319f9bb8bfbab9 Mon Sep 17 00:00:00 2001 From: Bruno Cabral Date: Mon, 8 Apr 2024 09:51:52 -0700 Subject: [PATCH 1/3] use official composer image --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 85703b8..e4f718d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM iamluc/composer +FROM composer:1.4.3 ADD . /usr/local/src/docker-hostmanager From 5ecab145b46ec5b53d8ba6a3dc3badf1850df75b Mon Sep 17 00:00:00 2001 From: Bruno Cabral Date: Mon, 8 Apr 2024 11:13:14 -0700 Subject: [PATCH 2/3] build_linux_amd64 --- .github/workflows/DockerHub.yml | 23 +++++++++++++++++++++++ composer.json | 1 + 2 files changed, 24 insertions(+) create mode 100644 .github/workflows/DockerHub.yml diff --git a/.github/workflows/DockerHub.yml b/.github/workflows/DockerHub.yml new file mode 100644 index 0000000..fc5b2e8 --- /dev/null +++ b/.github/workflows/DockerHub.yml @@ -0,0 +1,23 @@ +name: Build and Push Docker images to Docker Hub + +on: push +jobs: + build_linux_amd64: + name: Build linux/amd64 + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Login to Docker Hub + uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ secrets.DOCKERHUB_USERNAME }}/docker-hostname:0.0.1 diff --git a/composer.json b/composer.json index dfdba8d..5f984d6 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,7 @@ { "name": "iamluc/docker-hostmanager", "license": "MIT", + "version": "0.0.1", "type": "project", "description": "Update /etc/hosts to access running containers", "keywords": ["docker", "hosts"], From 5055b545bb159fb896f5242220289a0124eea38b Mon Sep 17 00:00:00 2001 From: Bruno Cabral Date: Mon, 8 Apr 2024 11:57:16 -0700 Subject: [PATCH 3/3] use buildx multi-arch-builder --- .github/workflows/DockerHub.yml | 22 ++++++++++++---------- composer.json | 2 +- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/.github/workflows/DockerHub.yml b/.github/workflows/DockerHub.yml index fc5b2e8..6a5f81a 100644 --- a/.github/workflows/DockerHub.yml +++ b/.github/workflows/DockerHub.yml @@ -2,22 +2,24 @@ name: Build and Push Docker images to Docker Hub on: push jobs: - build_linux_amd64: - name: Build linux/amd64 + build_job: + name: Build and push runs-on: ubuntu-latest + steps: - name: Checkout repository uses: actions/checkout@v4 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to Docker Hub - uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Build and push Docker image - uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0 - with: - context: . - push: ${{ github.event_name != 'pull_request' }} - tags: ${{ secrets.DOCKERHUB_USERNAME }}/docker-hostname:0.0.1 + + - name: Run Buildx and push image + run: | + docker buildx create --use --name multi-arch-builder --platform "linux/arm64,linux/amd64" + docker buildx build --platform "linux/arm64,linux/amd64" --tag ${{ secrets.DOCKERHUB_USERNAME }}/docker-hostmanager:0.0.4 --file Dockerfile --output type=image,push=true . diff --git a/composer.json b/composer.json index 5f984d6..42f7822 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "iamluc/docker-hostmanager", "license": "MIT", - "version": "0.0.1", + "version": "0.0.4", "type": "project", "description": "Update /etc/hosts to access running containers", "keywords": ["docker", "hosts"],