Skip to content

Docker Image

Docker Image #56

Workflow file for this run

name: Docker Image
on:
push:
branches:
- master
- publish-events-to-rabbitmq
# Run every week to get updated dependencies.
schedule:
- cron: '40 08 * * 1'
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Check Out Repo
uses: actions/checkout@v3
- name: Guix cache
uses: actions/cache@v2
with:
# Note: /gnu/store may exceed the limit of 5GiB, so don't
# cache it. TODO: Selective caching with 'guix archive'?
path: |
~/.cache/guix
key: guix-cache-${{ github.sha }}
restore-keys: |
guix-cache-
- name: Read channels.scm
run: |
echo "CHANNELS<<EOF" >> $GITHUB_ENV
cat ci/channels.scm >> $GITHUB_ENV
echo EOF >> $GITHUB_ENV
- name: Install Guix
uses: PromyLOPH/guix-install-action@v1
with:
channels: "${{ env.CHANNELS }}"
- name: Build mreg
run: guix build --fallback -m ./ci/manifest.scm
- name: Pack Docker image
run: >
guix pack --fallback -f docker --save-provenance --root=mreg-docker.tar.gz
-S /app=app -S /etc/profile=etc/profile
--entry-point=bin/mreg-wrapper
-m ./ci/manifest.scm
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: mreg-docker.tar.gz
path: mreg-docker.tar.gz
publish:
name: Publish
needs: build
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: mreg-docker.tar.gz
- name: Load image
run: docker load < mreg-docker.tar.gz
- name: Log in to registry
run: >
echo "${{ secrets.GITHUB_TOKEN }}"
| docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Push image
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/mreg
TAG_NAME=latest
[[ "$GITHUB_REF_NAME" == "master" ]] || TAG_NAME="$GITHUB_REF_NAME"
docker tag mreg-wrapper-mreg-python-wrapper:latest $IMAGE_ID:$TAG_NAME
docker push $IMAGE_ID:$TAG_NAME