Sandboxed Compiles: support configurable texlive image root via env var

This commit is contained in:
yu-i-i
2026-09-22 02:41:38 +02:00
parent 46d23c6c8b
commit a0acf2f72a
6 changed files with 10 additions and 6 deletions
+1 -1
View File
@@ -29,7 +29,7 @@ The CLSI can be configured through the following environment variables:
- `PROCESS_LIFE_SPAN_LIMIT_MS` - Process life span limit in milliseconds
- `SMOKE_TEST` - Whether to run smoke tests
- `TEXLIVE_IMAGE` - The TeX Live Docker image to use for sibling containers, e.g. `us-east1-docker.pkg.dev/overleaf-ops/ol-docker/texlive-full:2026.1`
- `TEX_LIVE_IMAGE_NAME_OVERRIDE` - The name of the registry for the Docker image e.g. `us-east1-docker.pkg.dev/overleaf-ops/ol-docker`
- `TEX_LIVE_DOCKER_IMAGE_ROOT` - The name of the registry for the Docker image e.g. `us-east1-docker.pkg.dev/overleaf-ops/ol-docker`
- `TEXLIVE_IMAGE_USER` - When using sibling containers, the user to run as in the TeX Live image. Defaults to `tex`
- `TEXLIVE_OPENOUT_ANY` - Sets the `openout_any` environment variable for TeX Live (see the `\openout` primitive [documentation](http://tug.org/texinfohtml/web2c.html#tex-invocation))
+1 -1
View File
@@ -168,7 +168,7 @@ function compile(req, res, next) {
draft: request.draft,
png2pdf: request.png2pdf,
imageName: request.imageName
? request.imageName
? Path.basename(request.imageName)
: undefined,
rootResourcePath: request.rootResourcePath,
stopOnFirstError: request.stopOnFirstError,
+3 -2
View File
@@ -41,8 +41,8 @@ const DockerRunner = {
}
if (Settings.texliveImageNameOveride != null) {
const img = image.split('/')
image = `${Settings.texliveImageNameOveride}/${img[2]}`
const img = Path.basename(image)
image = `${Settings.texliveImageNameOveride}/${img}`
}
if (compileGroup === 'synctex-output') {
@@ -238,6 +238,7 @@ const DockerRunner = {
const match = image.match(/:([0-9]+)\.[0-9]+|:TL([0-9]+)/)
// the rolling build does not follow our <year>.<version>.<patch> convention
const year = match ? match[1] || match[2] : 'rolling'
env.PATH = `/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/texlive/${year}/bin/x86_64-linux/`
const options = {
Cmd: command,
+1 -1
View File
@@ -98,7 +98,7 @@ module.exports = {
parallelFileDownloads:
parseInt(process.env.FILESTORE_PARALLEL_FILE_DOWNLOADS, 10) || 1,
filestoreDomainOveride: process.env.FILESTORE_DOMAIN_OVERRIDE,
texliveImageNameOveride: process.env.TEX_LIVE_IMAGE_NAME_OVERRIDE,
texliveImageNameOveride: process.env.TEX_LIVE_DOCKER_IMAGE_ROOT,
texliveOpenoutAny: process.env.TEXLIVE_OPENOUT_ANY,
texliveMaxPrintLine: process.env.TEXLIVE_MAX_PRINT_LINE,
enablePdfCaching: process.env.ENABLE_PDF_CACHING === 'true',
@@ -45,7 +45,7 @@ const ProjectOptionsHandler = {
if (!isAllowed) {
throw new OError('invalid imageName', { imageName })
}
return settings.imageRoot + '/' + imageName
return imageName
},
async setImageName(projectId, imageName) {
@@ -20,3 +20,6 @@ if (process.env.SANDBOXED_COMPILES === 'true') {
}
Settings.currentImageName = process.env.TEX_LIVE_DOCKER_IMAGE
}
const SandboxedCompilesModule = {}
export default SandboxedCompilesModule