forked from overleaf/overleaf
-
Notifications
You must be signed in to change notification settings - Fork 4
138 lines (135 loc) · 5.43 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: build and push sharelatex-base image
on:
workflow_dispatch:
inputs:
revision:
description: 'image revision number'
required: true
default: '1'
type: string
cache:
description: 'use cache'
required: true
default: false
type: boolean
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' && inputs.cache }}
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: Build and push
if: ${{ matrix.version != 'latest' && ! inputs.cache }}
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-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' && inputs.cache }}
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
- name: Build and push
if: ${{ matrix.version == 'latest' && !inputs.cache }}
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-to: type=inline