-
Notifications
You must be signed in to change notification settings - Fork 38
/
deploy.sh
executable file
·27 lines (24 loc) · 1.28 KB
/
deploy.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash
# login to docker
echo $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin &> /dev/null || exit 1
# push dev image (only latest)
if [ "$TRAVIS_BRANCH" = "dev" -a "$UBUNTU_VERSION" = "latest" ]; then
docker buildx build --progress plain --platform $PLATFORMS --build-arg UBUNTU_VERSION=$UBUNTU_VERSION \
-t $IMAGE:dev --push .
fi
# push master images (not when it's a pull request)
if [ "$TRAVIS_BRANCH" = "master" -a "$TRAVIS_PULL_REQUEST" = "false" ]; then
# tag including ubuntu version
if [ "$UBUNTU_VERSION" = "latest" ]; then
docker buildx build --progress plain --platform $PLATFORMS --build-arg UBUNTU_VERSION=$UBUNTU_VERSION \
-t $IMAGE:latest --push .
else
# build single platform and load it into local docker repository, so we can launch it
docker buildx build --progress plain --platform linux/amd64 --build-arg UBUNTU_VERSION=$UBUNTU_VERSION \
-t $IMAGE --load .
export VERSION=$(docker run --rm -it --entrypoint dpkg $IMAGE -s cups-daemon |grep ^Version | sed -e 's/Version. \([0-9.]*\)-.*/\1/')
# build for all platforms again and push with correct version tag
docker buildx build --progress plain --platform $PLATFORMS --build-arg UBUNTU_VERSION=$UBUNTU_VERSION \
-t $IMAGE:$VERSION-$UBUNTU_VERSION --push .
fi
fi