Skip to content

Refactor and enable Docker build workflow #171

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 10 additions & 13 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,14 @@ jobs:
build-and-push-images:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2

-
name: Docker meta
id: meta
uses: docker/metadata-action@v3
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/minitriga/Netbox-Device-Type-Library-Import
ghcr.io/${{ github.repository_owner }}/device-type-library-import
tags: |
type=raw,value=latest,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }}
type=ref,event=branch
Expand All @@ -37,24 +35,23 @@ jobs:
type=semver,pattern={{major}}.{{minor}}
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3
-
name: Login to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Build and push
uses: docker/build-push-action@v2
uses: docker/bake-action@v6
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
platforms: linux/amd64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
files: |
./docker-bake.hcl
cwd://${{ steps.meta.outputs.bake-file }}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.9-alpine
FROM python:3.13-alpine

ENV REPO_URL=https://github.com/netbox-community/devicetype-library.git
WORKDIR /app
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ docker build -t netbox-devicetype-import-library .
Alternatively you can pull a pre-built image from Github Container Registry (ghcr.io):

```
docker pull ghcr.io/minitriga/netbox-device-type-library-import
docker pull ghcr.io/netbox-community/device-type-library-import
```

The container supports the following env var as configuration :
Expand All @@ -92,7 +92,7 @@ The container supports the following env var as configuration :
To run :

```
docker run -e "NETBOX_URL=http://netbox:8080/" -e "NETBOX_TOKEN=98765434567890" ghcr.io/minitriga/netbox-device-type-library-import
docker run -e "NETBOX_URL=http://netbox:8080/" -e "NETBOX_TOKEN=98765434567890" ghcr.io/netbox-community/device-type-library-import
```

## 🧑‍💻 Contributing
Expand Down
15 changes: 15 additions & 0 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
target "docker-metadata-action" {}

target "default" {
inherits = ["docker-metadata-action"]
platforms = [
"linux/amd64",
"linux/arm64",
]
}

target "dev" {
tags = [
"ghcr.io/netbox-community/device-type-library-import:dev"
]
}