-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy path.travis.yml
64 lines (58 loc) · 2.64 KB
/
.travis.yml
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
---
dist: focal
services:
- docker
stages:
- Static test
- Build test
jobs:
include:
- stage: Static test
env:
- Test: hadolint
language: minimal
script:
- docker run -i -v $PWD/.hadolint.yml:/.hadolint.yml hadolint/hadolint < Dockerfile
- stage: Static test
env:
- Test: dockerfile_lint
language: node_js
node_js:
- "18"
script:
- npx --cache .npx dockerfile_lint
cache:
directories:
- .npx
- stage: Build test
language: minimal
before_script:
- if [[ "$TRAVIS_TAG" =~ ^[0-9]+(\.[0-9]+){2}$ ]]; then
AZCOPY_VERSION="$TRAVIS_TAG";
export VALID_TAG="true";
else
AZCOPY_VERSION=$(curl -sLo- https://api.github.com/repos/Azure/azure-storage-azcopy/releases | grep tag_name | head -n 1 | awk -F'"' '{print $4}' | sed 's/^v//g');
fi
- echo "$AZCOPY_VERSION"
- tag=($(echo $AZCOPY_VERSION | tr "." " "))
- DOCKER_REPO="$DOCKER_USERNAME/azcopy"
- DOCKER_REPO2="$DOCKER_USERNAME/azcopy"
- DOCKER_PLATFORM="linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7,linux/386"
script:
- if [ "$TRAVIS_PULL_REQUEST" = "true" ] || [ "true" != "$VALID_TAG" ]; then
docker build --build-arg AZCOPY_VERSION="$AZCOPY_VERSION" -t docker-azcopy:$TRAVIS_COMMIT .;
docker run docker-azcopy:$TRAVIS_COMMIT azcopy --version;
else
mkdir -p ~/.docker/cli-plugins;
wget -nv -O ~/.docker/cli-plugins/docker-buildx https://github.com/docker/buildx/releases/download/v0.10.5/buildx-v0.10.5.linux-amd64;
chmod a+x ~/.docker/cli-plugins/docker-buildx;
docker run --privileged multiarch/qemu-user-static --reset -p yes;
docker buildx create --use --name mybuilder;
docker login -u ${DOCKER_HUB_USER} -p ${DOCKER_HUB_PASS};
docker login -u ${GHCR_USER} -p ${GHCR_PASS};
travis_wait 30 docker buildx build --build-arg AZCOPY_VERSION="$AZCOPY_VERSION" -t "$DOCKER_REPO:latest" -t "$DOCKER_REPO2:latest" --platform "$DOCKER_PLATFORM" --push .;
fi
- if [ "true" = "$VALID_TAG" ]; then
docker buildx build --build-arg AZCOPY_VERSION="$AZCOPY_VERSION" -t "$DOCKER_REPO:$AZCOPY_VERSION" -t "$DOCKER_REPO:${tag[0]}.${tag[1]}" -t "$DOCKER_REPO:${tag[0]}" --platform "$DOCKER_PLATFORM" --push .;
docker buildx build --build-arg AZCOPY_VERSION="$AZCOPY_VERSION" -t "$DOCKER_REPO2:$AZCOPY_VERSION" -t "$DOCKER_REPO2:${tag[0]}.${tag[1]}" -t "$DOCKER_REPO2:${tag[0]}" --platform "$DOCKER_PLATFORM" --push .;
fi