Skip to content

Commit

Permalink
Update github actions for multiarch images
Browse files Browse the repository at this point in the history
Signed-off-by: Georgios Ntoutsos <gntouts@nubificus.co.uk>
  • Loading branch information
gntouts committed Jan 15, 2024
1 parent e760bbc commit 7d125f7
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 19 deletions.
40 changes: 25 additions & 15 deletions .github/workflows/docker-image-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ on:

env:
IMAGE_NAME: gntouts/eltrak
USER: gntouts
TAG: roll

jobs:

Expand All @@ -16,16 +14,28 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: docker login
env:
DOCKER_USER: ${{secrets.HUB_NAME }}
DOCKER_PASSWORD: ${{secrets.HUB_PWD }}
run: |
docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
echo ${{ env.IMAGE_NAME }}
echo ${{ env.USER }}
- name: Build the Docker image
run: docker build . --file Dockerfile --tag ${{ env.IMAGE_NAME }}:${{ env.TAG }}
- name: Docker Push
run: docker push ${{ env.IMAGE_NAME }}:${{ env.TAG }}
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.HUB_NAME }}
password: ${{ secrets.HUB_PWD }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: gntouts/eltrak:roll
labels: ${{ steps.meta.outputs.labels }}
12 changes: 8 additions & 4 deletions .github/workflows/docker-image-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2

uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
uses: docker/login-action@v3
with:
username: ${{ secrets.HUB_NAME }}
password: ${{ secrets.HUB_PWD }}
Expand All @@ -31,9 +34,10 @@ jobs:
images: ${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ In order to run the server locally (or anywhere else) run the following commands

`docker build -t eltrak .`

Alternatively, if you want to build a multi-platform image:

```bash
docker buildx build --platform linux/arm64,linux/amd64 --push -t gntouts/eltrak:latest .
```

3. Start the container

`docker run -dp 8888:80 eltrak`
Expand Down

0 comments on commit 7d125f7

Please sign in to comment.