docker: ensure cleaner contexts for Docker builds
Some checks failed
CI / 🤖 Check dependabot status (push) Has been cancelled
CI / 🐧 Test on Linux (${{ github.ref_type == 'tag' }}, misc) (push) Has been cancelled
CI / 🐧 Test on Linux (coverage) (push) Has been cancelled
CI / 🐧 Test on Linux (regular) (push) Has been cancelled
CI / ❄️ Build on Nix (push) Has been cancelled
CI / 🍏 Build and test on macOS (push) Has been cancelled
CI / 🧪 End-to-end testing (push) Has been cancelled
CI / 🔍 Upload code coverage (push) Has been cancelled
CI / 🔬 Test only Go (push) Has been cancelled
CI / 🔬 Test only JS (${{ needs.dependabot.outputs.package-ecosystem }}, 20) (push) Has been cancelled
CI / 🔬 Test only JS (${{ needs.dependabot.outputs.package-ecosystem }}, 22) (push) Has been cancelled
CI / 🔬 Test only JS (${{ needs.dependabot.outputs.package-ecosystem }}, 24) (push) Has been cancelled
CI / ⚖️ Check licenses (push) Has been cancelled
CI / 🐋 Build Docker images (push) Has been cancelled
CI / 🐋 Tag Docker images (push) Has been cancelled
CI / 🚀 Publish release (push) Has been cancelled
Build IPinfo geoipupdate image / Build Docker images (push) Has been cancelled
Update Nix dependency hashes / Update dependency hashes (push) Has been cancelled

`make docker` builds the context from a tarball. We don't use git
archive as we want to allow local modifications without committing them.
This is not unlike nix work.

For the other Docker files, use a tailored `.dockerignore`:

 - dev, ignore everything except bin/akvorado
 - ipinfo-geoipupdate, ignore everything except the update script
 - nix, let nix handle it from the Git repository
This commit is contained in:
Vincent Bernat
2025-11-19 20:41:47 +01:00
parent 20da0c1d2f
commit 08b86db25d
7 changed files with 9 additions and 6 deletions

View File

@@ -1,2 +0,0 @@
.git
console/frontend/node_modules/

View File

@@ -31,7 +31,7 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@v6
with:
context: docker
context: .
file: docker/Dockerfile.ipinfo-geoipupdate
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true

View File

@@ -286,8 +286,8 @@ version:
.PHONY: docker docker-dev
DOCKER_BUILD_ARGS =
docker: ; $(info $(M) build Docker image) @ ## Build Docker image
$Q docker build --pull -f docker/Dockerfile $(DOCKER_BUILD_ARGS) \
--build-arg VERSION=$(VERSION) -t ghcr.io/akvorado/akvorado:main .
$Q git ls-files | tar -T- -cf- | docker build --pull -f docker/Dockerfile $(DOCKER_BUILD_ARGS) \
--build-arg VERSION=$(VERSION) -t ghcr.io/akvorado/akvorado:main -
docker-dev: TARGETOS=linux
docker-dev: all ; $(info $(M) build development Docker image) @ ## Build development Docker image
$Q docker build -f docker/Dockerfile.dev $(DOCKER_BUILD_ARGS) \

View File

@@ -0,0 +1,2 @@
*
!bin/akvorado

View File

@@ -0,0 +1 @@
.git

View File

@@ -5,7 +5,7 @@ RUN apk add --no-cache curl
WORKDIR /data
VOLUME /data
COPY --chmod=555 ipinfo-geoipupdate.sh /usr/local/bin/ipinfo-geoipupdate.sh
COPY --chmod=555 docker/ipinfo-geoipupdate.sh /usr/local/bin/ipinfo-geoipupdate.sh
LABEL org.opencontainers.image.description="IPinfo database updater"
HEALTHCHECK --interval=20s CMD test -f /tmp/healthy

View File

@@ -0,0 +1,2 @@
*
!docker/ipinfo-geoipupdate.sh