parent
d9093470bb
commit
2a2c6b7ff8
@ -0,0 +1,20 @@
|
|||||||
|
sudo: required
|
||||||
|
|
||||||
|
services:
|
||||||
|
- docker
|
||||||
|
|
||||||
|
env:
|
||||||
|
matrix:
|
||||||
|
- ARCH=arm
|
||||||
|
- ARCH=arm64
|
||||||
|
- ARCH=amd64
|
||||||
|
|
||||||
|
script:
|
||||||
|
- ./travis-build.sh
|
||||||
|
- ./travis-test.sh
|
||||||
|
- >
|
||||||
|
if [ -n "$TRAVIS_TAG" ]; then
|
||||||
|
# push image
|
||||||
|
travis_retry timeout 5m docker login -u="$DOCKER_USER" -p="$DOCKER_PASS"
|
||||||
|
./travis-deploy.sh
|
||||||
|
fi
|
@ -0,0 +1,14 @@
|
|||||||
|
FROM golang
|
||||||
|
|
||||||
|
COPY . /code
|
||||||
|
WORKDIR /code
|
||||||
|
|
||||||
|
RUN CGO_ENABLED=0 go build -a -installsuffix cgo http.go
|
||||||
|
|
||||||
|
FROM scratch
|
||||||
|
|
||||||
|
COPY --from=0 /code/http /http
|
||||||
|
|
||||||
|
EXPOSE 8080
|
||||||
|
|
||||||
|
CMD ["/http"]
|
@ -0,0 +1,14 @@
|
|||||||
|
FROM golang
|
||||||
|
|
||||||
|
COPY . /code
|
||||||
|
WORKDIR /code
|
||||||
|
|
||||||
|
RUN CGO_ENABLED=0 GOOS=linux GOARCH=arm go build -a -installsuffix cgo http.go
|
||||||
|
|
||||||
|
FROM scratch
|
||||||
|
|
||||||
|
COPY --from=0 /code/http /http
|
||||||
|
|
||||||
|
EXPOSE 8080
|
||||||
|
|
||||||
|
CMD ["/http"]
|
@ -0,0 +1,14 @@
|
|||||||
|
FROM golang
|
||||||
|
|
||||||
|
COPY . /code
|
||||||
|
WORKDIR /code
|
||||||
|
|
||||||
|
RUN CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -a -installsuffix cgo http.go
|
||||||
|
|
||||||
|
FROM scratch
|
||||||
|
|
||||||
|
COPY --from=0 /code/http /http
|
||||||
|
|
||||||
|
EXPOSE 8080
|
||||||
|
|
||||||
|
CMD ["/http"]
|
@ -0,0 +1,39 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
which docker
|
||||||
|
|
||||||
|
systemctl stop docker
|
||||||
|
|
||||||
|
echo "Updating Docker engine to master"
|
||||||
|
curl -L -o /usr/local/bin/docker-containerd https://master.dockerproject.org/linux/amd64/docker-containerd
|
||||||
|
curl -L -o /usr/local/bin/docker-containerd-ctr https://master.dockerproject.org/linux/amd64/docker-containerd-ctr
|
||||||
|
curl -L -o /usr/local/bin/docker-containerd-shim https://master.dockerproject.org/linux/amd64/docker-containerd-shim
|
||||||
|
curl -L -o /usr/local/bin/dockerd https://master.dockerproject.org/linux/amd64/dockerd
|
||||||
|
curl -L -o /usr/local/bin/docker-init https://master.dockerproject.org/linux/amd64/docker-init
|
||||||
|
curl -L -o /usr/local/bin/docker-proxy https://master.dockerproject.org/linux/amd64/docker-proxy
|
||||||
|
curl -L -o /usr/local/bin/docker-runc https://master.dockerproject.org/linux/amd64/docker-runc
|
||||||
|
curl -L -o /usr/local/bin/docker https://master.dockerproject.org/linux/amd64/docker
|
||||||
|
|
||||||
|
systemctl start docker
|
||||||
|
|
||||||
|
docker version
|
||||||
|
|
||||||
|
|
||||||
|
if [ "$ARCH" != "amd64" ]; then
|
||||||
|
# prepare qemu
|
||||||
|
docker run --rm --privileged multiarch/qemu-user-static:register --reset
|
||||||
|
|
||||||
|
if [ "$ARCH" == "arm64" ]; then
|
||||||
|
# prepare qemu binary
|
||||||
|
docker create --name register hypriot/qemu-register
|
||||||
|
docker cp register:qemu-aarch64 qemu-aarch64-static
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -d tmp ]; then
|
||||||
|
docker rm build
|
||||||
|
rm -rf tmp
|
||||||
|
fi
|
||||||
|
|
||||||
|
docker build -t whoami -f "Dockerfile.$ARCH" .
|
@ -0,0 +1,45 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
image="stefanscherer/whoami"
|
||||||
|
docker tag whoami "$image:linux-$ARCH-$TRAVIS_TAG"
|
||||||
|
docker push "$image:linux-$ARCH-$TRAVIS_TAG"
|
||||||
|
|
||||||
|
if [ "$ARCH" == "amd64" ]; then
|
||||||
|
set +e
|
||||||
|
echo "Waiting for other images $image:linux-arm-$TRAVIS_TAG"
|
||||||
|
until docker run --rm stefanscherer/winspector "$image:linux-arm-$TRAVIS_TAG"
|
||||||
|
do
|
||||||
|
sleep 15
|
||||||
|
echo "Try again"
|
||||||
|
done
|
||||||
|
until docker run --rm stefanscherer/winspector "$image:linux-arm64-$TRAVIS_TAG"
|
||||||
|
do
|
||||||
|
sleep 15
|
||||||
|
echo "Try again"
|
||||||
|
done
|
||||||
|
until docker run --rm stefanscherer/winspector "$image:windows-amd64-$TRAVIS_TAG"
|
||||||
|
do
|
||||||
|
sleep 15
|
||||||
|
echo "Try again"
|
||||||
|
done
|
||||||
|
set -e
|
||||||
|
|
||||||
|
echo "Downloading manifest-tool"
|
||||||
|
wget https://github.com/estesp/manifest-tool/releases/download/v0.4.0/manifest-tool-linux-amd64
|
||||||
|
mv manifest-tool-linux-amd64 manifest-tool
|
||||||
|
chmod +x manifest-tool
|
||||||
|
./manifest-tool
|
||||||
|
|
||||||
|
echo "Pushing manifest $image:$TRAVIS_TAG"
|
||||||
|
./manifest-tool push from-args \
|
||||||
|
--platforms linux/amd64,linux/arm,linux/arm64,windows/amd64 \
|
||||||
|
--template "$image:OS-ARCH-$TRAVIS_TAG" \
|
||||||
|
--target "$image:$TRAVIS_TAG"
|
||||||
|
|
||||||
|
echo "Pushing manifest $image:latest"
|
||||||
|
./manifest-tool push from-args \
|
||||||
|
--platforms linux/amd64,linux/arm,linux/arm64,windows/amd64 \
|
||||||
|
--template "$image:OS-ARCH-$TRAVIS_TAG" \
|
||||||
|
--target "$image:latest"
|
||||||
|
fi
|
@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [ "$ARCH" == "amd64" ]; then
|
||||||
|
# test image
|
||||||
|
docker run -d -p 8080:8080 --name=whoamitest whoami
|
||||||
|
|
||||||
|
sleep 5
|
||||||
|
|
||||||
|
docker logs whoamitest
|
||||||
|
fi
|
Loading…
Reference in new issue