Skip to content

Docker Image CI

Docker Image CI #36

Workflow file for this run

name: Docker Image CI
on:
push:
# branches:
# - "master"
tags:
- "v*.*.*"
pull_request:
branches:
- "master"
jobs:
# # NOTE: Not required for now
# prepare:
# name: Prepare environment
# runs-on: ubuntu-latest
# steps:
# - name: Free Disk Space (Ubuntu)
# uses: insightsengineering/disk-space-reclaimer@v1
# with:
# # this might remove tools that are actually needed,
# # if set to "true" but frees about 6 GB
# tools-cache: true
# # all of these default to true, but feel free to set to
# # "false" if necessary for your workflow
# android: true
# dotnet: true
# haskell: true
# large-packages: true
# swap-storage: true
# docker-images: true
base:
name: Base image
runs-on: ubuntu-latest
# needs: prepare
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: rigon/sharelatex-full
# generate Docker tags based on the following events/attributes
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Print tags
run: printf "== TAGS ==\n${{ steps.meta.outputs.tags }}"
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
target: base
push: true
platforms: linux/amd64 #,linux/arm64,linux/arm/v6
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
shell-escape:
name: Shell-escape image
runs-on: ubuntu-latest
needs: base
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: rigon/sharelatex-full
flavor: |
latest=auto
suffix=-shell-escape,onlatest=true
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Print tags
run: printf "== TAGS ==\n${{ steps.meta.outputs.tags }}"
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
target: shell-escape
push: true
platforms: linux/amd64 #,linux/arm64,linux/arm/v6
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max