diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml
index 3de92c1..655fd71 100644
--- a/.github/workflows/docker-image.yml
+++ b/.github/workflows/docker-image.yml
@@ -11,30 +11,46 @@ on:
- "master"
jobs:
- build:
- name: Push Docker image to Docker Hub
+ # # 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: 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
- 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@v4
+ uses: docker/metadata-action@v5
with:
images: rigon/sharelatex-full
# generate Docker tags based on the following events/attributes
@@ -44,22 +60,58 @@ jobs:
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@v2
+ uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
- uses: docker/setup-buildx-action@v2
+ uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
- uses: docker/login-action@v2
+ 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@v4
+ uses: docker/build-push-action@v6
with:
- context: .
+ 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
+ cache-to: type=gha,mode=max
\ No newline at end of file
diff --git a/.github/workflows/dockerhub-monitor.yml b/.github/workflows/sharelatex-monitor.yml
similarity index 95%
rename from .github/workflows/dockerhub-monitor.yml
rename to .github/workflows/sharelatex-monitor.yml
index 13368f5..a07a942 100644
--- a/.github/workflows/dockerhub-monitor.yml
+++ b/.github/workflows/sharelatex-monitor.yml
@@ -1,4 +1,4 @@
-name: Monitor Docker Hub for New Tags
+name: Monitor Docker Hub for new tags
on:
push:
@@ -10,7 +10,7 @@ on:
jobs:
monitor:
- name: Check for new versions on Docker Hub
+ name: Check for new versions of Sharelatex
runs-on: ubuntu-latest
steps:
- name: Fetch latest tag from Docker Hub
diff --git a/Dockerfile b/Dockerfile
index 314cfd7..f81fe12 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,4 @@
-FROM sharelatex/sharelatex
+FROM sharelatex/sharelatex AS base
# # Install TeX Live: metapackage pulling in all components of TeX Live
# RUN set -x && \
@@ -33,5 +33,25 @@ RUN set -x && \
# Code Highlighting with minted
# https://www.overleaf.com/learn/latex/Code_Highlighting_with_minted
+RUN pip install latexminted
+
+####################
+# Stage shell-escape
+####################
+FROM base AS shell-escape
+
+# Tools mentioned by the community:
+# https://tex.stackexchange.com/questions/598818/how-can-i-enable-shell-escape
+
+# Enable shell-escape
+RUN printf "\n%% Enable shell-escape\nshell_escape = t\n" | \
+ /bin/bash -c "tee -a /usr/local/texlive/*/texmf.cnf"
+
+# Install additional tools used by TeX packages
RUN set -x && \
- pip install latexminted
+ apt-get update && \
+ apt-get install -y --no-install-recommends graphviz gnuplot inkscape asymptote && \
+ # Cleanup
+ apt-get clean && rm -rf /var/lib/apt
+
+RUN pip install dot2tex
diff --git a/README.md b/README.md
index 903630e..13fe868 100644
--- a/README.md
+++ b/README.md
@@ -11,11 +11,21 @@ ShareLatex with all Latex packages installed by default.
This is an extension of the [official sharelatex](https://hub.docker.com/r/sharelatex/sharelatex/).
+The goal is to create an image with many Latex packages as possible, so you do not have (hopefully) to worry about missing packages. The downside is the large size of the image.
+
The [tlmgr](https://www.tug.org/texlive/tlmgr.html) [full scheme](https://tex.stackexchange.com/questions/234749/downloading-every-package-with-tex-live) is installed on top of Sharelatex, plus additional external tools required by common LaTeX packges:
- [`latexminted`](https://pypi.org/project/latexminted/) for [Code Highlighting with minted](https://www.overleaf.com/learn/latex/Code_Highlighting_with_minted)
-The goal is to create an image with many Latex packages as possible, so you do not have (hopefully) to worry about missing packages. The downside is the large size of the image.
+And with shell-escape enabled:
+
+ - [Inkscape](https://inkscape.org/) to support [SVG images](https://en.wikipedia.org/wiki/SVG)
+ - [Graphviz](https://graphviz.org/) using [`dot2tex`](https://pypi.org/project/dot2tex/) package
+ - [Asymptote](https://asymptote.sourceforge.io/) using `asypictureB` package
+ - [gnuplot](http://www.gnuplot.info/) using `gnuplottex` package
+
+> [!WARNING]
+> Be aware that using `-shell-escape` or `-enable-write18` allows LATEX to run potentially arbitrary commands on your system. These should only be used when necessary, with documents from trusted sources. If you understand the implications use the docker image `rigon/sharelatex:latest-shell-escape` instead.
## How to run
diff --git a/docker-compose.yml b/docker-compose.yml
index 4212061..0ed0e37 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -8,7 +8,7 @@ services:
restart: always
# Server Pro users:
# image: quay.io/sharelatex/sharelatex-pro
- image: rigon/sharelatex-full
+ image: rigon/sharelatex-full # :latest-shell-escape
container_name: sharelatex
depends_on:
mongo:
@@ -53,33 +53,34 @@ services:
## Set for SSL via nginx-proxy
#VIRTUAL_HOST: 103.112.212.22
- # SHARELATEX_SITE_URL: http://sharelatex.mydomain.com
- # SHARELATEX_NAV_TITLE: Our ShareLaTeX Instance
- # SHARELATEX_HEADER_IMAGE_URL: http://somewhere.com/mylogo.png
- # SHARELATEX_ADMIN_EMAIL: support@it.com
+ # OVERLEAF_SITE_URL: http://sharelatex.mydomain.com
+ # OVERLEAF_NAV_TITLE: Our ShareLaTeX Instance
+ # OVERLEAF_HEADER_IMAGE_URL: http://somewhere.com/mylogo.png
+ # OVERLEAF_ADMIN_EMAIL: support@it.com
- # SHARELATEX_LEFT_FOOTER: '[{"text": "Powered by ShareLaTeX 2016"},{"text": "Another page I want to link to can be found here"} ]'
- # SHARELATEX_RIGHT_FOOTER: '[{"text": "Hello I am on the Right"} ]'
+ # OVERLEAF_LEFT_FOOTER: '[{"text": "Powered by ShareLaTeX 2016"},{"text": "Another page I want to link to can be found here"} ]'
+ # OVERLEAF_RIGHT_FOOTER: '[{"text": "Hello I am on the Right"} ]'
- # SHARELATEX_EMAIL_FROM_ADDRESS: "team@sharelatex.com"
+ # OVERLEAF_EMAIL_FROM_ADDRESS: "team@sharelatex.com"
- # SHARELATEX_EMAIL_AWS_SES_ACCESS_KEY_ID:
- # SHARELATEX_EMAIL_AWS_SES_SECRET_KEY:
+ # OVERLEAF_EMAIL_AWS_SES_ACCESS_KEY_ID:
+ # OVERLEAF_EMAIL_AWS_SES_SECRET_KEY:
- # SHARELATEX_EMAIL_SMTP_HOST: smtp.mydomain.com
- # SHARELATEX_EMAIL_SMTP_PORT: 587
- # SHARELATEX_EMAIL_SMTP_SECURE: false
- # SHARELATEX_EMAIL_SMTP_USER:
- # SHARELATEX_EMAIL_SMTP_PASS:
- # SHARELATEX_EMAIL_SMTP_TLS_REJECT_UNAUTH: true
- # SHARELATEX_EMAIL_SMTP_IGNORE_TLS: false
- # SHARELATEX_EMAIL_SMTP_NAME: '127.0.0.1'
- # SHARELATEX_EMAIL_SMTP_LOGGER: true
- # SHARELATEX_CUSTOM_EMAIL_FOOTER: "This system is run by department x"
+ # OVERLEAF_EMAIL_SMTP_HOST: smtp.mydomain.com
+ # OVERLEAF_EMAIL_SMTP_PORT: 587
+ # OVERLEAF_EMAIL_SMTP_SECURE: false
+ # OVERLEAF_EMAIL_SMTP_USER:
+ # OVERLEAF_EMAIL_SMTP_PASS:
+ # OVERLEAF_EMAIL_SMTP_TLS_REJECT_UNAUTH: true
+ # OVERLEAF_EMAIL_SMTP_IGNORE_TLS: false
+ # OVERLEAF_EMAIL_SMTP_NAME: '127.0.0.1'
+ # OVERLEAF_EMAIL_SMTP_LOGGER: true
+ # OVERLEAF_CUSTOM_EMAIL_FOOTER: "This system is run by department x"
################
## Server Pro ##
################
+ ## https://github.com/overleaf/overleaf/wiki/Server-Pro:-sandboxed-compiles
# SANDBOXED_COMPILES: 'true'
diff --git a/tests/asypictureB.tex b/tests/asypictureB.tex
new file mode 100644
index 0000000..9c655ad
--- /dev/null
+++ b/tests/asypictureB.tex
@@ -0,0 +1,87 @@
+\documentclass{article}
+\usepackage{asypictureB} % Include asypictureB package
+
+\begin{document}
+
+\title{LaTeX Document with Asymptote Graphic}
+\author{Your Name}
+\date{\today}
+\maketitle
+
+\section{Introduction}
+
+This is an example of including an Asymptote graphic within a LaTeX document using the \texttt{asypictureB} package. Asymptote allows for powerful vector graphic rendering, making it a great tool for illustrations and figures in technical documents.
+
+\begin{asypicture}{width=5cm}
+// Global Asymptote definitions can be put here.
+settings.prc=true;
+import three;
+usepackage("bm");
+texpreamble("\def\V#1{\bm{#1}}");
+// One can globally override the default toolbar settings here:
+// settings.toolbar=true;
+
+size(4cm,0);
+pen colour1=red;
+pen colour2=green;
+
+pair z0=(0,0);
+pair z1=(-1,0);
+pair z2=(1,0);
+real r=1.5;
+path c1=circle(z1,r);
+path c2=circle(z2,r);
+fill(c1,colour1);
+fill(c2,colour2);
+
+picture intersection=new picture;
+fill(intersection,c1,colour1+colour2);
+clip(intersection,c2);
+
+add(intersection);
+
+draw(c1);
+draw(c2);
+
+//draw("$\A$",box,z1); // Requires [inline] package option.
+//draw(Label("$\B$","$B$"),box,z2); // Requires [inline] package option.
+draw("$A$",box,z1);
+draw("$\V{B}$",box,z2);
+
+pair z=(0,-2);
+real m=3;
+margin BigMargin=Margin(0,m*dot(unit(z1-z),unit(z0-z)));
+
+draw(Label("$A\cap B$",0),conj(z)--z0,Arrow,BigMargin);
+draw(Label("$A\cup B$",0),z--z0,Arrow,BigMargin);
+draw(z--z1,Arrow,Margin(0,m));
+draw(z--z2,Arrow,Margin(0,m));
+
+shipout(bbox(0.25cm));
+\end{asypicture}
+
+\section{Asymptote Graphic Example}
+
+Below is an Asymptote graphic generated within the document:
+
+\begin{asypicture}{width=5cm}
+ // Begin Asymptote code
+ import graph;
+
+ size(5cm);
+ draw((0,0)--(2,2), blue+linewidth(1));
+ draw((0,2)--(2,0), red+linewidth(1));
+
+ label("$A$", (0,0), SW);
+ label("$B$", (2,2), NE);
+ label("$C$", (0,2), NW);
+ label("$D$", (2,0), SE);
+
+ draw((0,0)..(1,1.5)..(2,2), green+linewidth(0.8));
+\end{asypicture}
+
+\section{Conclusion}
+
+This document shows how to use the \texttt{asypictureB} package to include Asymptote graphics within a LaTeX document. This technique can be useful for including high-quality, scalable graphics in your document, particularly for complex diagrams and plots.
+
+\end{document}
diff --git a/tests/graphviz.tex b/tests/graphviz.tex
new file mode 100644
index 0000000..b58ff23
--- /dev/null
+++ b/tests/graphviz.tex
@@ -0,0 +1,56 @@
+\documentclass{article}
+\usepackage{hyperref}
+\usepackage{tikz}
+\usetikzlibrary{arrows}
+\usetikzlibrary{shapes}
+\usepackage{dot2texi} % Import dot2tex package
+
+\begin{document}
+
+\section*{Dot2Tex Graph Example}
+
+Here is an example of a simple directed graph rendered with Dot2TeX.
+
+\begin{dot2tex}[dot,tikz,options=-tmath]
+digraph G {
+ A -> B [label="1"];
+ B -> C [label="2"];
+ C -> D [label="3"];
+ D -> A [label="4"];
+ B -> D [label="5"];
+ A -> C [label="6"];
+}
+\end{dot2tex}
+
+\section*{Dot2Tex example labels}
+
+Example from: \href{https://dot2tex.readthedocs.io/en/latest/usage_guide.html#labels}{Dot2Tex Examples}
+
+\begin{dot2tex}[dot,tikz,options=-tmath]
+digraph G {
+ a_1 [texlbl="$\frac{\gamma}{2x^2+y^3}$"];
+ a_1 -> a_2 -> a_3 -> a_1
+ node [texmode="math"];
+ a_1 -> b_1 -> b_2 -> a_3;
+ b_1 [label="\\frac{\\gamma}{x^2}"];
+ node [texmode="verbatim"]
+ b_4 [label="\\beta"]
+ a_3 -> b_4 -> a_1;
+}
+\end{dot2tex}
+
+\section*{Dot2Tex example with autosize}
+
+Example from: \href{https://dot2tex.readthedocs.io/en/latest/usage_guide.html#examples}{Dot2Tex Examples}
+
+\begin{dot2tex}[dot,tikz,options=-tmath --autosize]
+digraph G {
+ node [shape=circle];
+ a_1 [texlbl="$x^2+\frac{\sin y}{y^2+\cos \beta}+\gamma_3$"];
+ a_1 -> a_2 [label=" ", texlbl="$x_1+x_3^2+z+c+v~~$"];
+ a_2 -> a_1;
+}
+\end{dot2tex}
+
+
+\end{document}