Skip to content

Commit

Permalink
feat: make cmd easily configurable
Browse files Browse the repository at this point in the history
fix: use right image url

fix: workdir for actions

fix: image command/entrypoint

fix: add necessary libraries for image generation

fix: chrome installation in the image

build: run only one build concurrently

fix: let puppeteer download the chrome it prefers

s

test
  • Loading branch information
tssge committed Nov 20, 2023
1 parent 7457130 commit b3caf5d
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 7 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Create and publish a Docker image
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
on:
push:
branches: ['main']

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.idea
.vagrant
26 changes: 20 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
FROM pandoc/latex:2.13
FROM pandoc/latex:edge-alpine

ENV CHROME_BIN="/usr/bin/chromium-browser"
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD="true"
WORKDIR /action/workspace

RUN apk add --update chromium npm
RUN npm install -g [email protected] --unsafe-perm=true
ENV PUPPETEER_EXECUTABLE_PATH="/usr/bin/chromium-browser" \
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD="true"

ENTRYPOINT ["./run-pandoc.sh"]
RUN set -x \
&& apk update \
&& apk upgrade \
\
# Add the packages
&& apk add --no-cache dumb-init curl make gcc g++ python3 linux-headers binutils-gold gnupg libstdc++ nss chromium \
npm bash git freetype ttf-freefont ca-certificates harfbuzz \
&& npm install -g puppeteer chromium https://github.com/drnachio/mermaid-filter-docker-ready --unsafe-perm=true \
\
# Do some cleanup
&& apk del --no-cache make gcc g++ python3 binutils-gold gnupg libstdc++ \
&& rm -rf /usr/include \
&& rm -rf /var/cache/apk/* /root/.node-gyp /usr/share/man /tmp/* \
&& echo

ENTRYPOINT ["pandoc", "-F", "mermaid-filter", "-o"]
23 changes: 23 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Vagrant.require_version ">= 2.2.4"
Vagrant.configure(2) do |config|
# Base box
config.vm.box = "ubuntu/lunar64"

# Virtual machine details - VirtualBox
config.vm.provider "virtualbox" do |v|
v.gui = false
v.cpus = 4
v.memory = 4096
v.name = "PandocMermaidAction"
v.default_nic_type = "virtio"

if Vagrant::Util::Platform.windows? then
v.customize ["modifyvm", :id, "--uartmode1", "client", "NUL"]
else
v.customize ["modifyvm", :id, "--uartmode1", "file", "/dev/null"]
end
end

# Shared folder owner to ubuntu instead of vagrant
config.vm.synced_folder ".", "/vagrant", name: "vagrant", disabled: false
end
14 changes: 13 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
---
name: 'Pandoc-Mermaid'
description: 'Run pandoc with the mermaid-filter'
inputs:
input-file:
description: 'The input file'
required: false
default: 'README.md'
output-file:
description: 'The output file'
required: false
default: 'README.pdf'
runs:
using: 'docker'
image: 'Dockerfile'
image: 'docker://ghcr.io/net9-oy/pandoc-mermaid-action:main'
args:
- ${{ inputs.output-file }}
- ${{ inputs.input-file }}

0 comments on commit b3caf5d

Please sign in to comment.