Skip to content

feat: seed Database category #8

feat: seed Database category

feat: seed Database category #8

Workflow file for this run

name: Build Docker development container
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches:
- master
- 'build-docker'
tags:
- '*'
- '!v*'
workflow_dispatch:
jobs:
signalk-server_npm_files:
if: github.repository == 'SignalK/signalk-server'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Node setup
uses: actions/setup-node@v6
with:
node-version: '24.x'
- name: Build npm files locally and upload artifacts
run: |
npm cache clean -f
npm install npm@latest -g
npm install --package-lock-only
npm ci && npm cache clean --force
npm run build:all
npm pack --workspaces
rm signalk-typedoc-signalk-theme*.tgz # This is only needed as a dev dependency
npm pack
- name: Upload artifacts
uses: actions/upload-artifact@v7
with:
retention-days: 1
name: packed-modules
path: |
*.tgz
docker_images:
needs: signalk-server_npm_files
strategy:
matrix:
os: [24.04, alpine]
node: [24.x]
vm: [ubuntu-latest, ubuntu-24.04-arm]
include:
- vm: ubuntu-latest
arch: amd
platform: linux/amd64
- vm: ubuntu-24.04-arm
arch: arm
node: 24.x
platform: linux/arm64
- os: 24.04
node: 24.x
node_safe: 24.x
- os: alpine
node: 24.x
node_safe: 24
runs-on: ${{ matrix.vm }}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Login to ghcr.io
if: github.event_name != 'pull_request'
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_PAT }}
- uses: actions/download-artifact@v8
with:
name: packed-modules
- name: Build and push
uses: docker/build-push-action@v7
with:
context: .
file: ./docker/Dockerfile
platforms: ${{ matrix.platform }}
push: true
tags: ghcr.io/signalk/signalk-server:${{ matrix.arch }}-${{ matrix.os }}-${{ matrix.node_safe }}-${{ github.run_id }}
build-args: |
REGISTRY=ghcr.io
BASE_IMAGE=${{ matrix.os }}-${{ matrix.node_safe }}
create-and-push-manifest:
needs: docker_images
runs-on: ubuntu-latest
strategy:
matrix:
os: [24.04, alpine]
node: [24.x]
include:
- os: 24.04
node: 24.x
suffix: -24.x
node_safe: 24.x
- os: alpine
node: 24.x
suffix: -24-alpine
node_safe: 24
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Docker meta
id: docker_meta
uses: docker/metadata-action@v6
with:
images: |
ghcr.io/signalk/signalk-server
tags: |
type=ref,event=branch
type=sha
flavor: |
suffix=${{ matrix.suffix }}
- name: Login to ghcr.io
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_PAT }}
- name: Create and push multi-arch manifest to GHCR
uses: int128/docker-manifest-create-action@v2
with:
tags: |
${{ steps.docker_meta.outputs.tags }}
sources: |
ghcr.io/signalk/signalk-server:amd-${{ matrix.os }}-${{ matrix.node_safe }}-${{ github.run_id }}
ghcr.io/signalk/signalk-server:arm-${{ matrix.os }}-${{ matrix.node_safe }}-${{ github.run_id }}
- name: Save tags to file
run: |
mkdir -p /tmp/tags
echo "${{ steps.docker_meta.outputs.tags }}" > /tmp/tags/${{ matrix.node_safe }}.txt
- name: Upload tag artifact
uses: actions/upload-artifact@v7
with:
name: ubuntu-tag-${{ matrix.node_safe }}
path: /tmp/tags/${{ matrix.node_safe }}.txt
retention-days: 1
copy-to-dockerhub:
needs: create-and-push-manifest
runs-on: ubuntu-latest
strategy:
matrix:
os: [24.04, alpine]
node: [24.x]
include:
- os: 24.04
node: 24.x
node_safe: 24.x
- os: alpine
node: 24.x
node_safe: 24
steps:
- name: Download tag artifact
uses: actions/download-artifact@v8
with:
name: ubuntu-tag-${{ matrix.node_safe }}
path: /tmp/tags
- name: Install skopeo
run: |
sudo apt-get update
sudo apt-get install -y skopeo
- name: Copy images from GHCR to Docker Hub
shell: bash
env:
GHCR_USERNAME: ${{ github.actor }}
GHCR_TOKEN: ${{ secrets.GHCR_PAT }}
DOCKER_HUB_USERNAME: signalkci
DOCKER_HUB_ACCESS_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
run: |
set -euo pipefail
TAGS_FILE="/tmp/tags/${{ matrix.node_safe }}.txt"
while IFS= read -r FULL_TAG || [ -n "${FULL_TAG:-}" ]; do
[ -z "${FULL_TAG:-}" ] && continue
TAG="${FULL_TAG##*:}"
echo "Copying: ${FULL_TAG} -> signalk/signalk-server:${TAG}"
skopeo copy --all \
--src-creds "${GHCR_USERNAME}:${GHCR_TOKEN}" \
--dest-creds "${DOCKER_HUB_USERNAME}:${DOCKER_HUB_ACCESS_TOKEN}" \
"docker://${FULL_TAG}" \
"docker://docker.io/signalk/signalk-server:${TAG}"
done < "$TAGS_FILE"
record-image-sizes:
needs: create-and-push-manifest
runs-on: ubuntu-latest
steps:
- name: Checkout metrics branch
uses: actions/checkout@v6
with:
ref: metrics
- name: Record image sizes
env:
GHCR_CREDS: '${{ github.actor }}:${{ secrets.GHCR_PAT }}'
run: |
set -euo pipefail
TIMESTAMP=$(date -u +%Y-%m-%dT%H:%M:%SZ)
COMMIT="${{ github.sha }}"
CSV="master-container_sizes.csv"
if [ ! -f "$CSV" ]; then
echo "timestamp,commit,tag,size_bytes" > "$CSV"
fi
REGISTRY="ghcr.io/signalk/signalk-server"
RUN_ID="${{ github.run_id }}"
for TAG in \
"amd-24.04-24.x-${RUN_ID}" \
"arm-24.04-24.x-${RUN_ID}" \
"amd-alpine-24-${RUN_ID}" \
"arm-alpine-24-${RUN_ID}"; do
DIGEST=$(skopeo inspect --raw --creds "${GHCR_CREDS}" \
"docker://${REGISTRY}:${TAG}" | \
jq -r '.manifests[0].digest')
SIZE=$(skopeo inspect --raw --creds "${GHCR_CREDS}" \
"docker://${REGISTRY}@${DIGEST}" | \
jq '[.layers[].size] | add')
echo "${TIMESTAMP},${COMMIT},${TAG%-${RUN_ID}},${SIZE}" >> "$CSV"
done
- name: Commit and push
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add master-container_sizes.csv
git commit -m "chore: record container sizes for ${GITHUB_SHA::7}"
git push
housekeeping:
needs: [copy-to-dockerhub, record-image-sizes]
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- name: Wait for GHCR indexing
run: sleep 60
- name: Remove Temporary & Untagged Docker Images from GHCR
continue-on-error: true
uses: dataaxiom/ghcr-cleanup-action@v1
with:
packages: signalk-server
delete-untagged: true
delete-tags: |
*-${{ github.run_id }}
token: ${{ secrets.GHCR_PAT }}