mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2025-01-03 14:57:22 +03:00
Added parallel docker image multi-arch building
This commit is contained in:
parent
1d26cd93fb
commit
91daec852f
3 changed files with 66 additions and 21 deletions
45
.travis.yml
45
.travis.yml
|
@ -1,7 +1,21 @@
|
||||||
|
dist: bionic
|
||||||
|
|
||||||
language: node_js
|
language: node_js
|
||||||
|
|
||||||
node_js:
|
jobs:
|
||||||
- "12.14.1"
|
fast_finish: true
|
||||||
|
include:
|
||||||
|
- name: "Docker publish"
|
||||||
|
node_js: '12.14.1'
|
||||||
|
if: NOT type = pull_request
|
||||||
|
env:
|
||||||
|
- DOCKER_PUBLISH="true"
|
||||||
|
- name: "CI"
|
||||||
|
node_js: '12.14.1'
|
||||||
|
env:
|
||||||
|
- DOCKER_PUBLISH="false"
|
||||||
|
allow_failures:
|
||||||
|
- name: "Docker publish"
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
directories:
|
directories:
|
||||||
|
@ -11,35 +25,34 @@ services:
|
||||||
- docker
|
- docker
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- npm ci
|
- if [[ ${DOCKER_PUBLISH} == 'true' ]]; then sudo bash ./scripts/docker/install-docker ; fi
|
||||||
|
- if [[ ${DOCKER_PUBLISH} == 'false' ]]; then npm ci ; fi
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- echo "Building commit range ${TRAVIS_COMMIT_RANGE}"
|
- if [[ ${DOCKER_PUBLISH} == 'false' ]]; then echo "Building commit range ${TRAVIS_COMMIT_RANGE}" ; fi
|
||||||
- export MUTATION_FILES=$(git diff ${TRAVIS_COMMIT_RANGE:-origin/master} --name-only | grep -E 'src\/(.*).(js|ts|jsx|tsx)$' | paste -sd ",")
|
- if [[ ${DOCKER_PUBLISH} == 'false' ]]; then export MUTATION_FILES=$(git diff ${TRAVIS_COMMIT_RANGE:-origin/master} --name-only | grep -E 'src\/(.*).(js|ts|jsx|tsx)$' | paste -sd ",") ; fi
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- npm run lint
|
- if [[ ${DOCKER_PUBLISH} == 'true' ]]; then bash ./scripts/docker/build ; fi
|
||||||
- npm run test:ci
|
- if [[ ${DOCKER_PUBLISH} == 'false' ]]; then npm run lint ; fi
|
||||||
- if [[ $TRAVIS_PULL_REQUEST != 'false' ]]; then docker build -t shlink-web-client:test . ; fi
|
- if [[ ${DOCKER_PUBLISH} == 'false' ]]; then npm run test:ci ; fi
|
||||||
- if [[ $TRAVIS_PULL_REQUEST != 'false' ]]; then npm run mutate:ci ; fi
|
- if [[ ${DOCKER_PUBLISH} == 'false' ]]; then docker build -t shlink-web-client:test . ; fi
|
||||||
|
- if [[ ${DOCKER_PUBLISH} == 'false' ]]; then npm run mutate:ci ; fi
|
||||||
|
|
||||||
after_success:
|
after_success:
|
||||||
- node_modules/.bin/ocular coverage/clover.xml
|
- if [[ ${DOCKER_PUBLISH} == 'false' ]]; then node_modules/.bin/ocular coverage/clover.xml ; fi
|
||||||
|
|
||||||
# Before deploying, build dist file for current travis tag
|
# Before deploying, build dist file for current travis tag
|
||||||
before_deploy:
|
before_deploy:
|
||||||
- if [[ ! -z $TRAVIS_TAG ]]; then npm run build ${TRAVIS_TAG#?} ; fi
|
- if [[ ! -z $TRAVIS_TAG && ${DOCKER_PUBLISH} == 'false' ]]; then npm run build ${TRAVIS_TAG#?} ; fi
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
- provider: script
|
|
||||||
script: bash ./scripts/docker/build
|
|
||||||
on:
|
|
||||||
all_branches: true
|
|
||||||
condition: $TRAVIS_PULL_REQUEST == 'false'
|
|
||||||
- provider: releases
|
- provider: releases
|
||||||
api_key:
|
api_key:
|
||||||
secure: jBvPwC7EAbViaNR83rwMSt5XQDK0Iu9rgvEMa7GoyShbHcvUCCPd73Tu9quNpKi6NKsDY3INHgtch3vgonjGNGDGJ+yDyIBzXcvsAX2x3UcHpRbgY12uiINVmQxBI1+OVQB016Nm+cKC/i5Z36K4EmDbYfo+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8pJoO1UpOlmvm62974NFfo0EG5YWwv6brUqz3QXpMjb8sWqgjltYMYJX3J7WZ34rIc+zt4NAmfhqgczaOC4pUGCiJ8jX3rMWIaQRn1AJ+5V337jL9fNDpTHny4phQjHrMJ1e0HZuNp0Xb5Q8wgqDPM=
|
||||||
file: "./dist/shlink-web-client_${TRAVIS_TAG#?}_dist.zip"
|
file: "./dist/shlink-web-client_${TRAVIS_TAG#?}_dist.zip"
|
||||||
skip_cleanup: true
|
skip_cleanup: true
|
||||||
on:
|
on:
|
||||||
|
all_branches: true
|
||||||
|
condition: ${DOCKER_PUBLISH} == 'false'
|
||||||
tags: true
|
tags: true
|
||||||
|
|
|
@ -1,13 +1,33 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
PLATFORMS="linux/arm/v7,linux/arm64/v8,linux/amd64"
|
||||||
|
# PLATFORMS="linux/amd64"
|
||||||
|
DOCKER_IMAGE="shlinkio/shlink-web-client"
|
||||||
|
BUILDX_VER=v0.4.1
|
||||||
|
export DOCKER_CLI_EXPERIMENTAL=enabled
|
||||||
|
|
||||||
|
mkdir -vp ~/.docker/cli-plugins/ ~/dockercache
|
||||||
|
curl --silent -L "https://github.com/docker/buildx/releases/download/${BUILDX_VER}/buildx-${BUILDX_VER}.linux-amd64" > ~/.docker/cli-plugins/docker-buildx
|
||||||
|
chmod a+x ~/.docker/cli-plugins/docker-buildx
|
||||||
|
|
||||||
|
docker buildx create --use
|
||||||
|
|
||||||
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
|
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
|
||||||
|
|
||||||
if [[ -z $TRAVIS_TAG ]]; then
|
if [[ -z $TRAVIS_TAG ]]; then
|
||||||
docker build -t shlinkio/shlink-web-client:latest .
|
docker buildx build --push \
|
||||||
docker push shlinkio/shlink-web-client:latest
|
--platform ${PLATFORMS} \
|
||||||
|
-t ${DOCKER_IMAGE}:latest .
|
||||||
|
|
||||||
else
|
else
|
||||||
docker build --build-arg VERSION=${TRAVIS_TAG#?} -t shlinkio/shlink-web-client:${TRAVIS_TAG#?} -t shlinkio/shlink-web-client:stable .
|
TAGS="-t ${DOCKER_IMAGE}:${TRAVIS_TAG#?}"
|
||||||
docker push shlinkio/shlink-web-client:${TRAVIS_TAG#?}
|
# Push stable tag only if this is not an alpha or beta release
|
||||||
docker push shlinkio/shlink-web-client:stable
|
[[ $TRAVIS_TAG != *"alpha"* && $TRAVIS_TAG != *"beta"* ]] && TAGS="${TAGS} -t ${DOCKER_IMAGE}:stable"
|
||||||
|
|
||||||
|
docker buildx build --push \
|
||||||
|
--build-arg SHLINK_VERSION=${TRAVIS_TAG#?} \
|
||||||
|
--platform ${PLATFORMS} \
|
||||||
|
${TAGS} .
|
||||||
fi
|
fi
|
||||||
|
|
12
scripts/docker/install-docker
Executable file
12
scripts/docker/install-docker
Executable file
|
@ -0,0 +1,12 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
# install latest docker version
|
||||||
|
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
|
||||||
|
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
|
||||||
|
apt-get update
|
||||||
|
apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce
|
||||||
|
|
||||||
|
# enable multiarch execution
|
||||||
|
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
|
Loading…
Reference in a new issue