build and push sharelatex-base image #22
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build and push sharelatex-base image | |
on: | |
workflow_dispatch: | |
inputs: | |
revision: | |
description: 'image revision number' | |
required: true | |
default: '1' | |
type: string | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: lcpu-club/sharelatex-base | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
attestations: write | |
id-token: write | |
strategy: | |
matrix: | |
version: ["latest",2022,2020] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
labels: | | |
org.opencontainers.image.title=sharelatex-base | |
org.opencontainers.image.description=base image for overleaf | |
#- name: Set up QEMU | |
# uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Prepare to build | |
run: | | |
cp ${{ github.workspace }}/server-ce/.dockerignore ${{ github.workspace }} | |
- name: Build and push | |
if: ${{ matrix.version != 'latest' }} | |
uses: docker/build-push-action@v6 | |
with: | |
provenance: false | |
build-args: | | |
TEXLIVE_MIRROR=https://ftp.math.utah.edu/pub/tex/historic/systems/texlive/${{ matrix.version }}/tlnet-final | |
TEXLIVE_VERSION=${{ matrix.version }} | |
push: true | |
context: ${{ github.workspace }} | |
file: ${{ github.workspace }}/server-ce/Dockerfile-base | |
#platforms: linux/amd64 | |
tags: | | |
ghcr.io/lcpu-club/sharelatex-base:${{ matrix.version }} | |
ghcr.io/lcpu-club/sharelatex-base:${{ matrix.version }}.${{ inputs.revision }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: | | |
type=registry,ref=ghcr.io/lcpu-club/sharelatex-base:${{ matrix.version }}.${{ inputs.revision }} | |
type=registry,ref=ghcr.io/lcpu-club/sharelatex-base:${{ matrix.version }} | |
type=registry,ref=ghcr.io/lcpu-club/sharelatex-base:latest | |
cache-to: type=inline | |
- name: Get current year | |
if: ${{ matrix.version == 'latest' }} | |
id: date | |
run: echo "year=$(date +'%Y')" >> $GITHUB_OUTPUT | |
- name: Build and push | |
if: ${{ matrix.version == 'latest' }} | |
uses: docker/build-push-action@v6 | |
with: | |
provenance: false | |
build-args: | | |
TEXLIVE_MIRROR=https://mirror.ox.ac.uk/sites/ctan.org/systems/texlive/tlnet | |
TEXLIVE_VERSION=${{ steps.date.outputs.year }} | |
push: true | |
context: ${{ github.workspace }} | |
file: ${{ github.workspace }}/server-ce/Dockerfile-base | |
#platforms: linux/amd64 | |
tags: | | |
ghcr.io/lcpu-club/sharelatex-base:latest | |
ghcr.io/lcpu-club/sharelatex-base:${{ steps.date.outputs.year }}.${{ inputs.revision }} | |
ghcr.io/lcpu-club/sharelatex-base:${{ steps.date.outputs.year }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: | | |
type=registry,ref=ghcr.io/lcpu-club/sharelatex-base:${{ steps.date.outputs.year }}.${{ inputs.revision }} | |
type=registry,ref=ghcr.io/lcpu-club/sharelatex-base:${{ steps.date.outputs.year }} | |
type=registry,ref=ghcr.io/lcpu-club/sharelatex-base:latest | |
cache-to: type=inline |