chore: docker ci workflow (Debian) (#286)
Diff
.github/workflows/devel.docker.yml | 12 +++--
.github/workflows/devel.yml | 7 +++-
.github/workflows/release.docker.manual.yml | 75 ++++++++++++++++++++++++++++++-
docker/debian/Dockerfile | 10 +++-
4 files changed, 99 insertions(+), 5 deletions(-)
@@ -1,14 +1,20 @@
name: devel-docker
on:
pull_request:
paths:
- docker/**/Dockerfile
- scripts/ci/**/*.sh
- .github/workflows/devel.docker.yml
push:
branches:
- master
- staging
- trying
- master
- staging
- trying
paths:
- docker/**/Dockerfile
- scripts/ci/**/*.sh
- .github/workflows/devel.docker.yml
env:
DOCKER_IMAGE: localhost:5000/github.com/static-web-server/static-web-server
@@ -1,6 +1,13 @@
name: devel
on:
pull_request:
paths:
- .github/workflows/devel.yml
- .cargo/config.toml
- Cargo.lock
- Cargo.toml
- src/**
- tests/**
push:
branches:
- master
@@ -0,0 +1,75 @@
name: release-docker-manual
on:
pull_request:
types:
- labeled
paths:
- docker/**/Dockerfile
- scripts/ci/**/*.sh
- .github/workflows/release.docker.manual.yml
jobs:
docker-image-debian:
runs-on: ubuntu-22.04
environment: docker-publish-manual
if: contains(github.event.label.name, 'docker:publish:v2.')
steps:
-
name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 1
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Prepare Docker envs
shell: bash
run: |
version=${{ github.event.label.name }}
semver=${version#*docker:publish:v}
echo "SEMVER=$semver" >> $GITHUB_ENV
echo "SEMVER_MAJOR=${semver%.*.*}" >> $GITHUB_ENV
echo "SEMVER_MINOR=${semver%.*}" >> $GITHUB_ENV
-
name: Docker meta debian
id: meta_debian
uses: docker/metadata-action@v4
with:
images: |
joseluisq/static-web-server
ghcr.io/static-web-server/static-web-server
flavor: |
latest=false
tags: |
type=raw,value=debian
type=raw,value=${{ env.SEMVER }}-debian
type=raw,value=${{ env.SEMVER_MAJOR }}-debian
type=raw,value=${{ env.SEMVER_MINOR }}-debian
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Login to ghcr.io
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Build and push (debian)
uses: docker/build-push-action@v4
with:
push: true
context: .
platforms: linux/amd64,linux/arm64,linux/386,linux/arm/v7,linux/arm/v6,linux/ppc64le,linux/s390x
file: ./docker/debian/Dockerfile
tags: ${{ steps.meta_debian.outputs.tags }}
build-args: |
SERVER_VERSION=${{ env.SEMVER }}
@@ -37,8 +37,14 @@ RUN set -ex \
&& uname -a \
&& cat /etc/os-release \
&& echo VERSION_NUMBER=$(cat /etc/debian_version) \
&& static-web-server --version \
&& static-web-server --help \
&& case "$TARGETPLATFORM" in \
**ppc64*|*s390x*) \
echo "warn: can not run sws binary on $TARGETPLATFORM architecture" ;; \
*) \
static-web-server --version; \
static-web-server --help; \
;; \
esac \
&& file /usr/local/bin/static-web-server \
&& true