forked from overleaf/overleaf
-
Notifications
You must be signed in to change notification settings - Fork 4
87 lines (84 loc) · 2.88 KB
/
build-base.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
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
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 }}
- 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:
build-args: |
BUILDKIT_INLINE_CACHE=1
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/overleaf-base:${{ matrix.version }}.${{ inputs.revision }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- 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:
build-args: |
BUILDKIT_INLINE_CACHE=1
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/overleaf-base:latest
ghcr.io/lcpu-club/overleaf-base:${{ steps.date.outputs.year }}.${{ inputs.revision }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max