mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2024-12-23 09:30:31 +03:00
Merge pull request #304 from acelaya-forks/feature/gh-action-docker-build
Feature/gh action docker build
This commit is contained in:
commit
59d23b584a
5 changed files with 48 additions and 48 deletions
24
.github/workflows/docker-image-build.yml
vendored
Normal file
24
.github/workflows/docker-image-build.yml
vendored
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
name: Build docker image
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install buildx
|
||||||
|
id: buildx
|
||||||
|
uses: crazy-max/ghaction-docker-buildx@v1
|
||||||
|
with:
|
||||||
|
buildx-version: latest
|
||||||
|
- name: Login to docker hub
|
||||||
|
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
|
||||||
|
- name: Build the image
|
||||||
|
run: bash ./scripts/docker/build
|
32
.travis.yml
32
.travis.yml
|
@ -16,25 +16,7 @@ cache:
|
||||||
jobs:
|
jobs:
|
||||||
fast_finish: true
|
fast_finish: true
|
||||||
include:
|
include:
|
||||||
- name: "Docker publish"
|
- node_js: '12.16.3'
|
||||||
if: NOT type = pull_request
|
|
||||||
install: sudo bash ./scripts/docker/install-docker
|
|
||||||
script: bash ./scripts/docker/build
|
|
||||||
# Overwrite all common steps that have to be different
|
|
||||||
before_script: echo "Before script"
|
|
||||||
after_success: echo "After success"
|
|
||||||
- name: "CI"
|
|
||||||
node_js: '12.16.3'
|
|
||||||
# Before deploying, build dist file for current travis tag
|
|
||||||
before_deploy: npm run build ${TRAVIS_TAG#?}
|
|
||||||
deploy:
|
|
||||||
- provider: releases
|
|
||||||
api_key:
|
|
||||||
secure: jBvPwC7EAbViaNR83rwMSt5XQDK0Iu9rgvEMa7GoyShbHcvUCCPd73Tu9quNpKi6NKsDY3INHgtch3vgonjGNGDGJ+yDyIBzXcvsAX2x3UcHpRbgY12uiINVmQxBI1+OVQB016Nm+cKC/i5Z36K4EmDbYfo+MrKndngM6AjcQFTwI8EwniIMaQgg4gNes//K8NhP5u0c3gwG+Q6jEGnq6uH3kcRgh6/epIZYpQyxjqWqKwF77sgcYj+X2Nf6XxtB5neuCi301UKLoLx8G0skh/Lm6KAIO4s9iIhIFa3UpoF21Ka0TxLpd2JxalLryCnFGlWWE6lxC9Htmc0TeRowJQlGdJXCskJ37xT9MljKY0fwNMu06VS/FUgykuCv+jP3zQu51pKu7Ew7+WeNPjautoOTu54VkdGyHcf2ThBNEyJQuiEwAQe4u7yAxY6R5ovEdvHBSIg4w1E5/Mxy5SMTCUlIAv6H7QQ1X9Z/zJm9HH5KeKz5tsHvQ/RIdSpgHXq/tC8o4Yup/LCFucXfrgvy/8pJoO1UpOlmvm62974NFfo0EG5YWwv6brUqz3QXpMjb8sWqgjltYMYJX3J7WZ34rIc+zt4NAmfhqgczaOC4pUGCiJ8jX3rMWIaQRn1AJ+5V337jL9fNDpTHny4phQjHrMJ1e0HZuNp0Xb5Q8wgqDPM=
|
|
||||||
file: "./dist/shlink-web-client_${TRAVIS_TAG#?}_dist.zip"
|
|
||||||
skip_cleanup: true
|
|
||||||
on:
|
|
||||||
tags: true
|
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- npm ci
|
- npm ci
|
||||||
|
@ -51,3 +33,15 @@ script:
|
||||||
|
|
||||||
after_success:
|
after_success:
|
||||||
- node_modules/.bin/ocular coverage/clover.xml
|
- node_modules/.bin/ocular coverage/clover.xml
|
||||||
|
|
||||||
|
# Before deploying, build dist file for current travis tag
|
||||||
|
before_deploy: npm run build ${TRAVIS_TAG#?}
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
- provider: releases
|
||||||
|
api_key:
|
||||||
|
secure: jBvPwC7EAbViaNR83rwMSt5XQDK0Iu9rgvEMa7GoyShbHcvUCCPd73Tu9quNpKi6NKsDY3INHgtch3vgonjGNGDGJ+yDyIBzXcvsAX2x3UcHpRbgY12uiINVmQxBI1+OVQB016Nm+cKC/i5Z36K4EmDbYfo+MrKndngM6AjcQFTwI8EwniIMaQgg4gNes//K8NhP5u0c3gwG+Q6jEGnq6uH3kcRgh6/epIZYpQyxjqWqKwF77sgcYj+X2Nf6XxtB5neuCi301UKLoLx8G0skh/Lm6KAIO4s9iIhIFa3UpoF21Ka0TxLpd2JxalLryCnFGlWWE6lxC9Htmc0TeRowJQlGdJXCskJ37xT9MljKY0fwNMu06VS/FUgykuCv+jP3zQu51pKu7Ew7+WeNPjautoOTu54VkdGyHcf2ThBNEyJQuiEwAQe4u7yAxY6R5ovEdvHBSIg4w1E5/Mxy5SMTCUlIAv6H7QQ1X9Z/zJm9HH5KeKz5tsHvQ/RIdSpgHXq/tC8o4Yup/LCFucXfrgvy/8pJoO1UpOlmvm62974NFfo0EG5YWwv6brUqz3QXpMjb8sWqgjltYMYJX3J7WZ34rIc+zt4NAmfhqgczaOC4pUGCiJ8jX3rMWIaQRn1AJ+5V337jL9fNDpTHny4phQjHrMJ1e0HZuNp0Xb5Q8wgqDPM=
|
||||||
|
file: "./dist/shlink-web-client_${TRAVIS_TAG#?}_dist.zip"
|
||||||
|
skip_cleanup: true
|
||||||
|
on:
|
||||||
|
tags: true
|
||||||
|
|
|
@ -16,6 +16,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
|
|
||||||
By default updates are immediately applied if real-time updates are enabled, to keep the behavior as it was.
|
By default updates are immediately applied if real-time updates are enabled, to keep the behavior as it was.
|
||||||
|
|
||||||
|
* [#297](https://github.com/shlinkio/shlink-web-client/issues/297) Enabled docker image multi-arch support, by moving image building to github actions.
|
||||||
|
|
||||||
#### Changed
|
#### Changed
|
||||||
|
|
||||||
* [#150](https://github.com/shlinkio/shlink-web-client/issues/150) The list of short URLs is now ordered by the creation date, showing newest results first.
|
* [#150](https://github.com/shlinkio/shlink-web-client/issues/150) The list of short URLs is now ordered by the creation date, showing newest results first.
|
||||||
|
|
|
@ -1,33 +1,25 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -e
|
set -ex
|
||||||
|
|
||||||
#PLATFORMS="linux/arm/v7,linux/arm64/v8,linux/amd64"
|
PLATFORMS="linux/arm/v7,linux/arm64/v8,linux/amd64"
|
||||||
PLATFORMS="linux/amd64"
|
|
||||||
DOCKER_IMAGE="shlinkio/shlink-web-client"
|
DOCKER_IMAGE="shlinkio/shlink-web-client"
|
||||||
BUILDX_VER=v0.4.1
|
|
||||||
export DOCKER_CLI_EXPERIMENTAL=enabled
|
|
||||||
|
|
||||||
mkdir -vp ~/.docker/cli-plugins/ ~/dockercache
|
if [[ "$GITHUB_REF" == *"main"* ]]; then
|
||||||
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
|
|
||||||
|
|
||||||
if [[ -z $TRAVIS_TAG ]]; then
|
|
||||||
docker buildx build --push \
|
docker buildx build --push \
|
||||||
--platform ${PLATFORMS} \
|
--platform ${PLATFORMS} \
|
||||||
-t ${DOCKER_IMAGE}:latest .
|
-t ${DOCKER_IMAGE}:latest .
|
||||||
|
|
||||||
|
# If ref is not main, then this is a tag. Build that docker tag and also "stable"
|
||||||
else
|
else
|
||||||
TAGS="-t ${DOCKER_IMAGE}:${TRAVIS_TAG#?}"
|
VERSION=${GITHUB_REF#refs/tags/v}
|
||||||
|
TAGS="-t ${DOCKER_IMAGE}:${VERSION}"
|
||||||
|
|
||||||
# Push stable tag only if this is not an alpha or beta release
|
# Push stable tag only if this is not an alpha or beta release
|
||||||
[[ $TRAVIS_TAG != *"alpha"* && $TRAVIS_TAG != *"beta"* ]] && TAGS="${TAGS} -t ${DOCKER_IMAGE}:stable"
|
[[ $GITHUB_REF != *"alpha"* && $GITHUB_REF != *"beta"* ]] && TAGS="${TAGS} -t ${DOCKER_IMAGE}:stable"
|
||||||
|
|
||||||
docker buildx build --push \
|
docker buildx build --push \
|
||||||
--build-arg VERSION=${TRAVIS_TAG#?} \
|
--build-arg VERSION=${VERSION} \
|
||||||
--platform ${PLATFORMS} \
|
--platform ${PLATFORMS} \
|
||||||
${TAGS} .
|
${TAGS} .
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
#!/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