mirror of
https://github.com/Threnklyn/wg-ui.git
synced 2026-06-06 22:00:09 +02:00
CI Update (UserSpace and Cache) (#87)
- Setting up build pipeline for UserSpace images (docker) - Adding a cache to speed up build process using github.com/actions/cache
This commit is contained in:
@@ -10,11 +10,10 @@ jobs:
|
|||||||
name: Docker
|
name: Docker
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
-
|
- name: Checkout
|
||||||
name: Checkout
|
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
-
|
|
||||||
name: Prepare
|
- name: Prepare
|
||||||
id: prepare
|
id: prepare
|
||||||
run: |
|
run: |
|
||||||
DOCKER_IMAGE=embarkstudios/wireguard-ui
|
DOCKER_IMAGE=embarkstudios/wireguard-ui
|
||||||
@@ -27,46 +26,128 @@ jobs:
|
|||||||
echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} \
|
echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} \
|
||||||
--build-arg VERSION=${VERSION} \
|
--build-arg VERSION=${VERSION} \
|
||||||
${TAGS} --file Dockerfile .
|
${TAGS} --file Dockerfile .
|
||||||
-
|
|
||||||
name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: crazy-max/ghaction-docker-buildx@master
|
uses: crazy-max/ghaction-docker-buildx@master
|
||||||
-
|
|
||||||
name: Docker Buildx (build)
|
- name: Cache Docker Buildx
|
||||||
|
uses: actions/cache@v2
|
||||||
|
id: cache
|
||||||
|
with:
|
||||||
|
path: /tmp/.buildx-cache
|
||||||
|
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-buildx-
|
||||||
|
|
||||||
|
- name: Docker Buildx (build)
|
||||||
run: |
|
run: |
|
||||||
docker buildx build --output "type=image,push=false" ${{ steps.prepare.outputs.buildx_args }}
|
docker buildx build \
|
||||||
-
|
--cache-from "type=local,src=/tmp/.buildx-cache" \
|
||||||
name: Docker Login
|
--cache-to "type=local,dest=/tmp/.buildx-cache" \
|
||||||
|
--output "type=image,push=false" \
|
||||||
|
${{ steps.prepare.outputs.buildx_args }}
|
||||||
|
|
||||||
|
- name: Docker Login
|
||||||
if: success()
|
if: success()
|
||||||
env:
|
env:
|
||||||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
||||||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
run: |
|
run: |
|
||||||
echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin
|
echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin
|
||||||
-
|
|
||||||
name: Docker Buildx (push)
|
- name: Docker Buildx (push)
|
||||||
if: success()
|
if: success()
|
||||||
run: |
|
run: |
|
||||||
docker buildx build --output "type=image,push=true" ${{ steps.prepare.outputs.buildx_args }}
|
docker buildx build \
|
||||||
-
|
--cache-from "type=local,src=/tmp/.buildx-cache" \
|
||||||
name: Docker Check Manifest
|
--output "type=image,push=true" \
|
||||||
|
${{ steps.prepare.outputs.buildx_args }}
|
||||||
|
|
||||||
|
- name: Docker Check Manifest
|
||||||
if: always()
|
if: always()
|
||||||
run: |
|
run: |
|
||||||
docker run --rm mplatform/mquery ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }}
|
docker run --rm mplatform/mquery ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }}
|
||||||
-
|
|
||||||
name: Clear
|
- name: Clear
|
||||||
|
if: always()
|
||||||
|
run: |
|
||||||
|
rm -f ${HOME}/.docker/config.json
|
||||||
|
|
||||||
|
docker-userspace:
|
||||||
|
name: Docker UserSpace
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Prepare
|
||||||
|
id: prepare
|
||||||
|
run: |
|
||||||
|
DOCKER_IMAGE=embarkstudios/wireguard-ui
|
||||||
|
DOCKER_PLATFORMS=linux/amd64,linux/arm64,linux/arm/v7
|
||||||
|
VERSION=userspace
|
||||||
|
|
||||||
|
TAGS="--tag ${DOCKER_IMAGE}:${VERSION}"
|
||||||
|
echo ::set-output name=docker_image::${DOCKER_IMAGE}
|
||||||
|
echo ::set-output name=version::${VERSION}
|
||||||
|
echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} \
|
||||||
|
--build-arg VERSION=${VERSION} \
|
||||||
|
${TAGS} --file UserSpace.Dockerfile .
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: crazy-max/ghaction-docker-buildx@master
|
||||||
|
|
||||||
|
- name: Cache Docker Buildx
|
||||||
|
uses: actions/cache@v2
|
||||||
|
id: cache
|
||||||
|
with:
|
||||||
|
path: /tmp/.buildx-cache
|
||||||
|
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-buildx-
|
||||||
|
|
||||||
|
- name: Docker Buildx (build)
|
||||||
|
run: |
|
||||||
|
docker buildx build \
|
||||||
|
--cache-from "type=local,src=/tmp/.buildx-cache" \
|
||||||
|
--cache-to "type=local,dest=/tmp/.buildx-cache" \
|
||||||
|
--output "type=image,push=false" \
|
||||||
|
${{ steps.prepare.outputs.buildx_args }}
|
||||||
|
|
||||||
|
- name: Docker Login
|
||||||
|
if: success()
|
||||||
|
env:
|
||||||
|
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
run: |
|
||||||
|
echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin
|
||||||
|
|
||||||
|
- name: Docker Buildx (push)
|
||||||
|
if: success()
|
||||||
|
run: |
|
||||||
|
docker buildx build \
|
||||||
|
--cache-from "type=local,src=/tmp/.buildx-cache" \
|
||||||
|
--output "type=image,push=true" \
|
||||||
|
${{ steps.prepare.outputs.buildx_args }}
|
||||||
|
|
||||||
|
- name: Docker Check Manifest
|
||||||
|
if: always()
|
||||||
|
run: |
|
||||||
|
docker run --rm mplatform/mquery ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }}
|
||||||
|
|
||||||
|
- name: Clear
|
||||||
if: always()
|
if: always()
|
||||||
run: |
|
run: |
|
||||||
rm -f ${HOME}/.docker/config.json
|
rm -f ${HOME}/.docker/config.json
|
||||||
|
|
||||||
docker-debug:
|
docker-debug:
|
||||||
name: Debug
|
name: Docker Debug
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
-
|
- name: Checkout
|
||||||
name: Checkout
|
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
-
|
|
||||||
name: Prepare
|
- name: Prepare
|
||||||
id: prepare
|
id: prepare
|
||||||
run: |
|
run: |
|
||||||
DOCKER_IMAGE=embarkstudios/wireguard-ui
|
DOCKER_IMAGE=embarkstudios/wireguard-ui
|
||||||
@@ -79,33 +160,49 @@ jobs:
|
|||||||
echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} \
|
echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} \
|
||||||
--build-arg VERSION=${VERSION} \
|
--build-arg VERSION=${VERSION} \
|
||||||
${TAGS} --file Dockerfile.debug .
|
${TAGS} --file Dockerfile.debug .
|
||||||
-
|
|
||||||
name: Set up Buildx
|
- name: Set up Buildx
|
||||||
uses: crazy-max/ghaction-docker-buildx@master
|
uses: crazy-max/ghaction-docker-buildx@master
|
||||||
-
|
|
||||||
name: Bocker Buildx (build)
|
- name: Cache Docker Buildx
|
||||||
|
uses: actions/cache@v2
|
||||||
|
id: cache
|
||||||
|
with:
|
||||||
|
path: /tmp/.buildx-cache
|
||||||
|
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-buildx-
|
||||||
|
|
||||||
|
- name: Docker Buildx (build)
|
||||||
run: |
|
run: |
|
||||||
docker buildx build --output "type=image,push=false" ${{ steps.prepare.outputs.buildx_args }}
|
docker buildx build \
|
||||||
-
|
--cache-from "type=local,src=/tmp/.buildx-cache" \
|
||||||
name: Docker Login
|
--cache-to "type=local,dest=/tmp/.buildx-cache" \
|
||||||
|
--output "type=image,push=false" \
|
||||||
|
${{ steps.prepare.outputs.buildx_args }}
|
||||||
|
|
||||||
|
- name: Docker Login
|
||||||
if: success()
|
if: success()
|
||||||
env:
|
env:
|
||||||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
||||||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
run: |
|
run: |
|
||||||
echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin
|
echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin
|
||||||
-
|
|
||||||
name: Docker Buildx (push)
|
- name: Docker Buildx (push)
|
||||||
if: success()
|
if: success()
|
||||||
run: |
|
run: |
|
||||||
docker buildx build --output "type=image,push=true" ${{ steps.prepare.outputs.buildx_args }}
|
docker buildx build \
|
||||||
-
|
--cache-from "type=local,src=/tmp/.buildx-cache" \
|
||||||
name: Docker Check Manifest
|
--output "type=image,push=true" \
|
||||||
|
${{ steps.prepare.outputs.buildx_args }}
|
||||||
|
|
||||||
|
- name: Docker Check Manifest
|
||||||
if: always()
|
if: always()
|
||||||
run: |
|
run: |
|
||||||
docker run --rm mplatform/mquery ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }}
|
docker run --rm mplatform/mquery ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }}
|
||||||
-
|
|
||||||
name: Clear
|
- name: Clear
|
||||||
if: always()
|
if: always()
|
||||||
run: |
|
run: |
|
||||||
rm -f ${HOME}/.docker/config.json
|
rm -f ${HOME}/.docker/config.json
|
||||||
|
|||||||
Reference in New Issue
Block a user