From 86ead8922d5efefe5411256461a99b2038cc7591 Mon Sep 17 00:00:00 2001 From: Markus Pesch Date: Tue, 31 Aug 2021 18:29:06 +0200 Subject: [PATCH] Initial Commit --- .drone.yml | 388 +++++++++++++++++++++++++++++++++++++++++++ .editorconfig | 12 ++ .gitattributes | 1 + .gitignore | 1 + .markdownlint.yaml | 144 ++++++++++++++++ Dockerfile.archlinux | 24 +++ Dockerfile.centos | 25 +++ Dockerfile.debian | 34 ++++ Dockerfile.fedora | 26 +++ Dockerfile.ubuntu | 35 ++++ LICENSE | 13 ++ README.md | 70 ++++++++ build.sh | 16 ++ 13 files changed, 789 insertions(+) create mode 100644 .drone.yml create mode 100644 .editorconfig create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 .markdownlint.yaml create mode 100644 Dockerfile.archlinux create mode 100644 Dockerfile.centos create mode 100644 Dockerfile.debian create mode 100644 Dockerfile.fedora create mode 100644 Dockerfile.ubuntu create mode 100644 LICENSE create mode 100644 README.md create mode 100755 build.sh diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..adb8476 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,388 @@ +--- +kind: pipeline +type: kubernetes +name: linter + +platform: + os: linux + arch: amd64 + +steps: +- name: markdown lint + commands: + - markdownlint *.md + image: docker.io/tmknom/markdownlint:0.23.1 + resources: + limits: + cpu: 50 + memory: 50M + +- name: email-notification + environment: + PLUGIN_HOST: + from_secret: smtp_host + PLUGIN_USERNAME: + from_secret: smtp_username + PLUGIN_PASSWORD: + from_secret: smtp_password + PLUGIN_FROM: + from_secret: smtp_mail_address + image: docker.io/drillster/drone-email:latest + resources: + limits: + cpu: 50 + memory: 25M + when: + status: + - changed + - failure + +trigger: + event: + exclude: + - tag + +--- +kind: pipeline +type: docker +name: archlinux + +steps: +- name: archlinux + image: docker.io/volkerraschek/build-image:latest + commands: + - ./build.sh archlinux latest + environment: + CONTAINER_IMAGE_REGISTRY_PASSWORD: + from_secret: container_image_registry_password + volumes: + - name: docker_socket + path: /var/run/docker.sock + +- name: notify + image: drillster/drone-email + environment: + PLUGIN_HOST: + from_secret: smtp_host + PLUGIN_USERNAME: + from_secret: smtp_username + PLUGIN_PASSWORD: + from_secret: smtp_password + PLUGIN_FROM: + from_secret: smtp_mail_address + when: + status: + - changed + - failure + +trigger: + when: + branch: + - master + event: + - push + - cron + +volumes: +- name: docker_socket + host: + path: /var/run/docker.sock + +--- +kind: pipeline +type: docker +name: centos + +steps: +- name: centos7 + image: docker.io/volkerraschek/build-image:latest + commands: + - ./build.sh centos 7 + environment: + CONTAINER_IMAGE_REGISTRY_PASSWORD: + from_secret: container_image_registry_password + volumes: + - name: docker_socket + path: /var/run/docker.sock + +- name: notify + image: drillster/drone-email + environment: + PLUGIN_HOST: + from_secret: smtp_host + PLUGIN_USERNAME: + from_secret: smtp_username + PLUGIN_PASSWORD: + from_secret: smtp_password + PLUGIN_FROM: + from_secret: smtp_mail_address + when: + status: + - changed + - failure + +trigger: + when: + branch: + - master + event: + - push + - cron + +volumes: +- name: docker_socket + host: + path: /var/run/docker.sock + +--- +kind: pipeline +type: docker +name: debian + +steps: +- name: 8-slim + image: docker.io/volkerraschek/build-image:latest + commands: + - ./build.sh debian 8-slim + environment: + CONTAINER_IMAGE_REGISTRY_PASSWORD: + from_secret: container_image_registry_password + volumes: + - name: docker_socket + path: /var/run/docker.sock + +- name: 9-slim + image: docker.io/volkerraschek/build-image:latest + commands: + - ./build.sh debian 9-slim + environment: + CONTAINER_IMAGE_REGISTRY_PASSWORD: + from_secret: container_image_registry_password + volumes: + - name: docker_socket + path: /var/run/docker.sock + +- name: 10-slim + image: docker.io/volkerraschek/build-image:latest + commands: + - ./build.sh debian 10-slim + environment: + CONTAINER_IMAGE_REGISTRY_PASSWORD: + from_secret: container_image_registry_password + volumes: + - name: docker_socket + path: /var/run/docker.sock + +- name: 11-slim + image: docker.io/volkerraschek/build-image:latest + commands: + - ./build.sh debian 11-slim + environment: + CONTAINER_IMAGE_REGISTRY_PASSWORD: + from_secret: container_image_registry_password + volumes: + - name: docker_socket + path: /var/run/docker.sock + +- name: notify + image: drillster/drone-email + environment: + PLUGIN_HOST: + from_secret: smtp_host + PLUGIN_USERNAME: + from_secret: smtp_username + PLUGIN_PASSWORD: + from_secret: smtp_password + PLUGIN_FROM: + from_secret: smtp_mail_address + when: + status: + - changed + - failure + +trigger: + when: + branch: + - master + event: + - push + - cron + +volumes: +- name: docker_socket + host: + path: /var/run/docker.sock + +--- +kind: pipeline +type: docker +name: fedora + +steps: +- name: fedora-33 + image: docker.io/volkerraschek/build-image:latest + commands: + - ./build.sh fedora 33 + environment: + CONTAINER_IMAGE_REGISTRY_PASSWORD: + from_secret: container_image_registry_password + volumes: + - name: docker_socket + path: /var/run/docker.sock + +- name: fedora-34 + image: docker.io/volkerraschek/build-image:latest + commands: + - ./build.sh fedora 34 + environment: + CONTAINER_IMAGE_REGISTRY_PASSWORD: + from_secret: container_image_registry_password + volumes: + - name: docker_socket + path: /var/run/docker.sock + +- name: notify + image: drillster/drone-email + environment: + PLUGIN_HOST: + from_secret: smtp_host + PLUGIN_USERNAME: + from_secret: smtp_username + PLUGIN_PASSWORD: + from_secret: smtp_password + PLUGIN_FROM: + from_secret: smtp_mail_address + when: + status: + - changed + - failure + +trigger: + when: + branch: + - master + event: + - push + - cron + +volumes: +- name: docker_socket + host: + path: /var/run/docker.sock + +--- +kind: pipeline +type: docker +name: ubuntu + +steps: +- name: ubuntu-16.04 + image: docker.io/volkerraschek/build-image:latest + commands: + - ./build.sh ubuntu 16.04 + environment: + CONTAINER_IMAGE_REGISTRY_PASSWORD: + from_secret: container_image_registry_password + volumes: + - name: docker_socket + path: /var/run/docker.sock + +- name: ubuntu-18.04 + image: docker.io/volkerraschek/build-image:latest + commands: + - ./build.sh ubuntu 18.04 + environment: + CONTAINER_IMAGE_REGISTRY_PASSWORD: + from_secret: container_image_registry_password + volumes: + - name: docker_socket + path: /var/run/docker.sock + +- name: ubuntu-20.04 + image: docker.io/volkerraschek/build-image:latest + commands: + - ./build.sh ubuntu 20.04 + environment: + CONTAINER_IMAGE_REGISTRY_PASSWORD: + from_secret: container_image_registry_password + volumes: + - name: docker_socket + path: /var/run/docker.sock + +- name: notify + image: drillster/drone-email + environment: + PLUGIN_HOST: + from_secret: smtp_host + PLUGIN_USERNAME: + from_secret: smtp_username + PLUGIN_PASSWORD: + from_secret: smtp_password + PLUGIN_FROM: + from_secret: smtp_mail_address + when: + status: + - changed + - failure + +trigger: + when: + branch: + - master + event: + - push + - cron + +volumes: +- name: docker_socket + host: + path: /var/run/docker.sock + +--- +kind: pipeline +type: kubernetes +name: sync + +platform: + os: linux + arch: amd64 + +steps: +- name: github + image: docker.io/appleboy/drone-git-push:latest + resources: + limits: + cpu: 50 + memory: 25M + settings: + branch: master + remote: ssh://git@github.com/volker-raschek/latex-docker.git + force: true + ssh_key: + from_secret: ssh_key + +- name: email-notification + environment: + PLUGIN_HOST: + from_secret: smtp_host + PLUGIN_USERNAME: + from_secret: smtp_username + PLUGIN_PASSWORD: + from_secret: smtp_password + PLUGIN_FROM: + from_secret: smtp_mail_address + image: docker.io/drillster/drone-email:latest + resources: + limits: + cpu: 50 + memory: 25M + when: + status: + - changed + - failure + +trigger: + event: + - push + repo: + - volker.raschek/latex-docker diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..b53e68c --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = false + +[Makefile] +indent_style = tab \ No newline at end of file diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..dcd9d00 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +Makefile eol=lf \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2eea525 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.env \ No newline at end of file diff --git a/.markdownlint.yaml b/.markdownlint.yaml new file mode 100644 index 0000000..57b2fbf --- /dev/null +++ b/.markdownlint.yaml @@ -0,0 +1,144 @@ +# markdownlint YAML configuration +# https://github.com/DavidAnson/markdownlint/blob/main/schema/.markdownlint.yaml + +# Default state for all rules +default: true + +# Path to configuration file to extend +extends: null + +# MD003/heading-style/header-style - Heading style +MD003: + # Heading style + style: "atx" + +# MD004/ul-style - Unordered list style +MD004: + style: "dash" + +# MD007/ul-indent - Unordered list indentation +MD007: + # Spaces for indent + indent: 2 + # Whether to indent the first level of the list + start_indented: false + +# MD009/no-trailing-spaces - Trailing spaces +MD009: + # Spaces for line break + br_spaces: 2 + # Allow spaces for empty lines in list items + list_item_empty_lines: false + # Include unnecessary breaks + strict: false + +# MD010/no-hard-tabs - Hard tabs +MD010: + # Include code blocks + code_blocks: true + +# MD012/no-multiple-blanks - Multiple consecutive blank lines +MD012: + # Consecutive blank lines + maximum: 1 + +# MD013/line-length - Line length +MD013: + # Number of characters + line_length: 80 + # Number of characters for headings + heading_line_length: 80 + # Number of characters for code blocks + code_block_line_length: 80 + # Include code blocks + code_blocks: false + # Include tables + tables: false + # Include headings + headings: true + # Include headings + headers: true + # Strict length checking + strict: false + # Stern length checking + stern: false + +# MD022/blanks-around-headings/blanks-around-headers - Headings should be surrounded by blank lines +MD022: + # Blank lines above heading + lines_above: 1 + # Blank lines below heading + lines_below: 1 + +# MD024/no-duplicate-heading/no-duplicate-header - Multiple headings with the same content +MD024: + # Only check sibling headings + allow_different_nesting: true + +# MD025/single-title/single-h1 - Multiple top-level headings in the same document +MD025: + # Heading level + level: 1 + # RegExp for matching title in front matter + front_matter_title: "^\\s*title\\s*[:=]" + +# MD026/no-trailing-punctuation - Trailing punctuation in heading +MD026: + # Punctuation characters + punctuation: ".,;:!。,;:!" + +# MD029/ol-prefix - Ordered list item prefix +MD029: + # List style + style: "one_or_ordered" + +# MD030/list-marker-space - Spaces after list markers +MD030: + # Spaces for single-line unordered list items + ul_single: 1 + # Spaces for single-line ordered list items + ol_single: 1 + # Spaces for multi-line unordered list items + ul_multi: 1 + # Spaces for multi-line ordered list items + ol_multi: 1 + +# MD033/no-inline-html - Inline HTML +MD033: + # Allowed elements + allowed_elements: [] + +# MD035/hr-style - Horizontal rule style +MD035: + # Horizontal rule style + style: "---" + +# MD036/no-emphasis-as-heading/no-emphasis-as-header - Emphasis used instead of a heading +MD036: + # Punctuation characters + punctuation: ".,;:!?。,;:!?" + +# MD041/first-line-heading/first-line-h1 - First line in a file should be a top-level heading +MD041: + # Heading level + level: 1 + # RegExp for matching title in front matter + front_matter_title: "^\\s*title\\s*[:=]" + +# MD044/proper-names - Proper names should have the correct capitalization +MD044: + # List of proper names + names: [] + # - some-thing + # Include code blocks + code_blocks: false + +# MD046/code-block-style - Code block style +MD046: + # Block style + style: "fenced" + +# MD048/code-fence-style - Code fence style +MD048: + # Code fence syle + style: "backtick" \ No newline at end of file diff --git a/Dockerfile.archlinux b/Dockerfile.archlinux new file mode 100644 index 0000000..0727702 --- /dev/null +++ b/Dockerfile.archlinux @@ -0,0 +1,24 @@ +# Base-Image +FROM docker.io/library/archlinux:latest + +# Labels +LABEL maintainer="Markus Pesch " + +# Runs +RUN pacman --sync --refresh --noconfirm --sysupgrade +RUN pacman --sync --noconfirm \ + biber \ + curl \ + git \ + gnuplot \ + make \ + python-pygments \ + texlive-bin \ + texlive-lang \ + texlive-most + +ENV PATH=/usr/bin/vendor_perl:${PATH} + +# Workspace +WORKDIR /workspace +VOLUME [ "/workspace" ] diff --git a/Dockerfile.centos b/Dockerfile.centos new file mode 100644 index 0000000..ffc0ae4 --- /dev/null +++ b/Dockerfile.centos @@ -0,0 +1,25 @@ +# Build-Arguments +ARG TAG=latest + +# Base-Image +FROM docker.io/library/centos:${TAG} + +# Labels +LABEL maintainer="Markus Pesch " + +# Runs +RUN yum update --assumeyes +RUN yum install --assumeyes \ + biber \ + curl \ + git \ + gnuplot \ + latexmk \ + make \ + python-pygments \ + texlive \ + texlive-*.noarch + +# Workspace +WORKDIR /workspace +VOLUME [ "/workspace" ] diff --git a/Dockerfile.debian b/Dockerfile.debian new file mode 100644 index 0000000..4d886ec --- /dev/null +++ b/Dockerfile.debian @@ -0,0 +1,34 @@ +# Build-Arguments +ARG TAG=latest + +# Base-Image +FROM docker.io/library/debian:${TAG} + +# Labels +LABEL maintainer="Markus Pesch " + +# Environment +ENV DEBIAN_FRONTEND="noninteractive" + +# Runs +RUN apt-get update +RUN apt-get upgrade --yes +RUN apt-get install --yes \ + biber \ + curl \ + git \ + gnuplot \ + latexmk \ + make \ + texlive-full + +# version specific packages +RUN if [ $(cat /etc/debian_version) != "11.0" ]; then apt-get install --yes python-pygments; fi +RUN if [ $(cat /etc/debian_version) = "11.0" ]; then apt-get install --yes python3-pygments; fi + +# remove dpkg lists +RUN rm --recursive --force /var/lib/apt/lists/* + +# Workspace +WORKDIR /workspace +VOLUME [ "/workspace" ] diff --git a/Dockerfile.fedora b/Dockerfile.fedora new file mode 100644 index 0000000..8c29951 --- /dev/null +++ b/Dockerfile.fedora @@ -0,0 +1,26 @@ +# Build-Arguments +ARG TAG=latest + +# Base-Image +FROM docker.io/library/fedora:${TAG} + +# Labels +LABEL maintainer="Markus Pesch " + +# Runs +RUN yum update --assumeyes +RUN yum install --assumeyes \ + biber \ + curl \ + git \ + gnuplot \ + latexmk \ + make \ + python-pygments \ + texlive-collection-bibtexextra \ + texlive-collection-fontutils \ + texlive-collection-langeuropean + +# Workspace +WORKDIR /workspace +VOLUME [ "/workspace" ] diff --git a/Dockerfile.ubuntu b/Dockerfile.ubuntu new file mode 100644 index 0000000..6661366 --- /dev/null +++ b/Dockerfile.ubuntu @@ -0,0 +1,35 @@ +# Build-Arguments +ARG TAG=latest + +# Base-Image +FROM docker.io/library/ubuntu:${TAG} + +# Labels +LABEL maintainer="Markus Pesch " + +# Environment +ENV DEBIAN_FRONTEND="noninteractive" + +# Runs +RUN apt-get update +RUN apt-get upgrade --yes +RUN apt-get install --yes \ + biber \ + curl \ + git \ + gnuplot \ + latexmk \ + make \ + texlive-full \ + xindy + +# version specific packages +RUN if [ $(cat /etc/debian_version) != "bullseye/sid" ]; then apt-get install --yes python-pygments; fi +RUN if [ $(cat /etc/debian_version) = "bullseye/sid" ]; then apt-get install --yes python3-pygments; fi + +# remove dpkg lists +RUN rm --recursive --force /var/lib/apt/lists/* + +# Workspace +WORKDIR /workspace +VOLUME [ "/workspace" ] diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..5a82408 --- /dev/null +++ b/LICENSE @@ -0,0 +1,13 @@ +Copyright 2019 Markus Pesch + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..a2bba30 --- /dev/null +++ b/README.md @@ -0,0 +1,70 @@ +# Docker Latex + +[![Build Status](https://drone.cryptic.systems/api/badges/volker.raschek/latex-docker/status.svg)](https://drone.cryptic.systems/volker.raschek/latex-docker) +[![Docker Pulls](https://img.shields.io/docker/pulls/volkerraschek/latex)](https://hub.docker.com/r/volkerraschek/latex) + +This repository, hosted on +[git.cryptic.systems](https://git.cryptic.systems/volker.raschek/latex-docker), +contains Dockerfiles to build different container images based on differend base +images. Any container image has the tex compiler and the minted package +included. Throught this are all container images able to compile tex source code +with source code highlighting. + +## Images + +Available Images: + +- volkerraschek/latex:latest-archlinux +- volkerraschek/latex:latest-debian8-slim +- volkerraschek/latex:latest-debian9-slim +- volkerraschek/latex:latest-debian10-slim +- volkerraschek/latex:latest-fedora-30 +- volkerraschek/latex:latest-fedora-31 +- volkerraschek/latex:latest-centos-7 +- volkerraschek/latex:latest-ubuntu-16.04 +- volkerraschek/latex:latest-ubuntu-18.04 +- volkerraschek/latex:latest-ubuntu-20.04 + +You can find a complete list of all docker images based on different +distributions on [Docker Hub](https://hub.docker.com/r/volkerraschek/latex-docker/tags). + +## Usage + +### Latexmk + +Here is an example based on ubuntu 18.04 to compile a PDF file with `latexmk` +from `index.tex`. Run this command in your root directory of your Latex files or +change the `volume` option with the `${PWD}` variable. + +```bash +$ docker run \ + --rm \ + --user="$(shell id -u):$(shell id -g)" \ + --net="none" \ + --volume="${PWD}:/workspace" volkerraschek/latex:latest-ubuntu-18.04 \ + latexmk \ + -shell-escape \ + -synctex=1 \ + -interaction=nonstopmode \ + -file-line-error \ + -pdf index.tex +``` + +### pdflatex + +Here is a example based on ubuntu 18.04 to compile a PDF file with `pdflatex` +from `index.tex`. Run this command in your root directory of your Latex files +or change the `volume` option with the `${PWD}` variable. + +```bash +$ docker run \ + --rm \ + --user="$(shell id -u):$(shell id -g)" \ + --net="none" \ + --volume="${PWD}:/workspace" volkerraschek/latex:latest-ubuntu-18.04 \ + pdflatex \ + -shell-escape \ + -synctex=1 \ + -interaction=nonstopmode \ + -enable-write18 index.tex +``` diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..f5e17a1 --- /dev/null +++ b/build.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +set -ex + +OS=${1:-archlinux} +VERSION=${2:-latest} + +TAG=latest-${OS}-${VERSION} +if [ "${OS}" = "archlinux" ]; then + TAG=latest-${OS} +fi + +docker build --build-arg TAG=${VERSION} --file Dockerfile.${OS} --tag volkerraschek/latex:${TAG} . +echo ${CONTAINER_IMAGE_REGISTRY_PASSWORD} | docker login docker.io --username volkerraschek --password-stdin +docker push volkerraschek/latex:${TAG} +docker image rm volkerraschek/latex:${TAG} \ No newline at end of file