mirror of
https://github.com/mailvelope/keyserver.git
synced 2026-10-24 08:19:18 +03:00
- Update Node.js version from 18 to 22 (matching engines >= 20) - Add required BASE_URL to env.sample and README Docker section - Remove obsolete HTTPS_UPGRADE/HTTPS_KEY_PIN settings from env.sample - Rename PAPERTRAIL_HOST/PORT to SYSLOG_HOST/PORT in env.sample - Update GitHub Actions checkout from v2 to v4 - Exclude MongoDB shell script mongo-init.js from ESLint
80 lines
1.9 KiB
YAML
80 lines
1.9 KiB
YAML
name: Docker
|
|
|
|
on:
|
|
push:
|
|
# Publish `master` as Docker `latest` image.
|
|
branches:
|
|
- master
|
|
|
|
# Publish `v1.2.3` tags as releases.
|
|
tags:
|
|
- '*'
|
|
|
|
# Run tests for any PRs.
|
|
pull_request:
|
|
|
|
jobs:
|
|
# Run tests.
|
|
# See also https://docs.docker.com/docker-hub/builds/automated-testing/
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Run tests
|
|
run: docker build . --file Dockerfile
|
|
|
|
# Push image to GitHub Packages.
|
|
# See also https://docs.docker.com/docker-hub/builds/
|
|
push:
|
|
# Ensure test job passes before pushing image.
|
|
needs: test
|
|
|
|
runs-on: ubuntu-latest
|
|
if: github.event_name == 'push'
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Login to ghcr.io
|
|
uses: docker/login-action@v2
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Compute tag
|
|
id: compute-tag
|
|
run: |
|
|
IMAGE_ID=ghcr.io/${{ github.repository }}
|
|
|
|
# Change all uppercase to lowercase
|
|
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
|
|
|
|
# Strip git ref prefix from version
|
|
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
|
|
|
|
# Strip "v" prefix from tag name
|
|
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
|
|
|
|
# Use Docker `latest` tag convention
|
|
[ "$VERSION" == "master" ] && VERSION=latest
|
|
|
|
echo IMAGE_ID=$IMAGE_ID
|
|
echo VERSION=$VERSION
|
|
|
|
echo "DOCKER_TAG=$IMAGE_ID:$VERSION" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Push multi-arch image
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
platforms: linux/amd64,linux/arm64
|
|
push: true
|
|
tags: ${{ steps.compute-tag.outputs.DOCKER_TAG }}
|
|
|