Skip to content
This repository was archived by the owner on Feb 18, 2026. It is now read-only.

Commit 0f7bb25

Browse files
committed
Build multi-arch docker images
1 parent 2e6057d commit 0f7bb25

File tree

4 files changed

+21
-7
lines changed

4 files changed

+21
-7
lines changed

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
**
2-
!build/fritzbox_smarthome_exporter.linux.amd64
2+
!build/fritzbox_smarthome_exporter.linux.*

.travis.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
language: go
2+
dist: focal
23
sudo: required
34

45
env:
@@ -20,16 +21,26 @@ matrix:
2021
allow_failures:
2122
- go: tip
2223

24+
before_install:
25+
- mkdir -p ~/.docker/cli-plugins/
26+
- curl --silent -L "https://github.com/docker/buildx/releases/download/v0.3.0/buildx-v0.3.0.linux-amd64" > ~/.docker/cli-plugins/docker-buildx
27+
- chmod a+x ~/.docker/cli-plugins/docker-buildx
28+
2329
install:
2430
- go mod download
2531
- go get github.com/mitchellh/gox
2632

2733
script:
2834
- go vet $(go list ./... | grep -v /vendor/)
2935
- go test -v ./...
30-
- if [ "${LATEST}" = "true" ]; then gox -os="darwin" -os="linux" -os="windows" -arch="amd64" -arch="arm64" -osarch="linux/386" -osarch="linux/arm" -osarch="windows/386"
31-
-output="build/fritzbox_smarthome_exporter.{{.OS}}.{{.Arch}}" -ldflags "-extldflags \"-static\" -X main.Rev=`git rev-parse --short HEAD`" -verbose ./...; fi
32-
- if [ "${LATEST}" = "true" -a -n "${TRAVIS_TAG}" ]; then docker build -t "jaymedh/fritzbox_smarthome_exporter:${TRAVIS_TAG}" .; fi
36+
- if [ "${LATEST}" = "true" ]; then
37+
gox -os="darwin" -os="linux" -os="windows" -arch="amd64" -arch="arm64" -osarch="linux/386" -osarch="linux/arm" -osarch="windows/386"
38+
-output="build/fritzbox_smarthome_exporter.{{.OS}}.{{.Arch}}" -ldflags "-extldflags \"-static\" -X main.Rev=`git rev-parse --short HEAD`" -verbose ./...;
39+
fi
40+
- if [ "${LATEST}" = "true" -a -n "${TRAVIS_TAG}" ]; then
41+
docker buildx create --use;
42+
docker buildx build --platform linux/amd64,linux/arm64,linux/arm,linux/386 -t "jaymedh/fritzbox_smarthome_exporter:${TRAVIS_TAG}" .;
43+
fi
3344

3445
deploy:
3546
- provider: releases

Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
FROM scratch
22

3-
COPY build/fritzbox_smarthome_exporter.linux.amd64 /
3+
ARG TARGETOS
4+
ARG TARGETARCH
5+
6+
COPY build/fritzbox_smarthome_exporter.${TARGETOS}.${TARGETARCH} /fritzbox_smarthome_exporter
47

58
EXPOSE 9103
69

7-
ENTRYPOINT ["/fritzbox_smarthome_exporter.linux.amd64"]
10+
ENTRYPOINT ["/fritzbox_smarthome_exporter"]

docker_push.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/bin/bash
22
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
3-
docker push "jaymedh/fritzbox_smarthome_exporter:${TRAVIS_TAG}"
3+
docker buildx build --push --platform linux/amd64,linux/arm64,linux/arm,linux/386 -t "jaymedh/fritzbox_smarthome_exporter:${TRAVIS_TAG}" .

0 commit comments

Comments
 (0)