Skip to content

switch to live repo

switch to live repo #4

Workflow file for this run

name: Build & push Docker image
# Build the environment image whenever the environment changes (lockfile,
# Dockerfile, or launcher) on ANY branch, plus a manual trigger.
# - lock-<hash> and <sha> tags are pushed on every branch, so the smoke test
# running on a feature branch can pull the freshly-built environment.
# - :latest is pushed ONLY from main/develop, so feature branches never
# overwrite the image end users pull.
on:
push:
paths:
- Dockerfile
- start.sh
- program/renv.lock
workflow_dispatch:
env:
IMAGE: pauljonasjost/comicsart
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Compute image tags
id: meta
run: |
HASH=$(sha256sum program/renv.lock | cut -c1-8)
{
echo "tags<<EOF"
echo "${IMAGE}:lock-${HASH}"
echo "${IMAGE}:${{ github.sha }}"
if [ "${{ github.ref }}" = "refs/heads/main" ] || [ "${{ github.ref }}" = "refs/heads/develop" ]; then
echo "${IMAGE}:latest"
fi
echo "EOF"
} >> "$GITHUB_OUTPUT"
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=registry,ref=${{ env.IMAGE }}:buildcache
cache-to: type=registry,ref=${{ env.IMAGE }}:buildcache,mode=max