-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add (docker): pandoc image docToolchain/docToolchain#433
- Loading branch information
Showing
2 changed files
with
122 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: Build and push 'standard pandoc image' to Docker | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'master' | ||
- 'main' | ||
- 'develop' | ||
- 'feature/**' | ||
- 'bugfix/**' | ||
workflow_dispatch: {} | ||
|
||
env: | ||
DTC_VERSION: v2.2.0 | ||
|
||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v3 | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- | ||
name: Login to DockerHub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- | ||
name: Build Image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: alpine | ||
build-args: DTC_VERSION=${{ env.DTC_VERSION }} | ||
load: true | ||
# TODO Make tag/version dependent on branch (push normal version only when on main branch, otherwise derive temporary version from branch name/datetime/commit-id/...) | ||
tags: doctoolchain/doctoolchain-with-pandoc:${{ env.DTC_VERSION }} | ||
- | ||
name: Test Image | ||
run: | | ||
docker run \ | ||
--rm \ | ||
-v ${PWD}/test:/workspace \ | ||
-w /workspace \ | ||
doctoolchain/doctoolchain-with-pandoc:${{ env.DTC_VERSION }} \ | ||
bash -c "set -eu; test -w /etc/environment && ls -l /etc/environment; doctoolchain . tasks" | ||
- | ||
name: Push Image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: alpine | ||
push: true | ||
tags: doctoolchain/doctoolchain-with-pandoc:${{ env.DTC_VERSION }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
FROM eclipse-temurin:11-jdk-alpine | ||
|
||
# see https://github.com/docker-library/openjdk/issues/73 | ||
ENV LC_CTYPE en_US.UTF-8 | ||
|
||
RUN addgroup -S dtcgroup && adduser -S dtcuser -G dtcgroup | ||
|
||
RUN apk update && apk upgrade && apk add --no-cache build-base | ||
|
||
RUN echo "add needed tools" && \ | ||
apk add --no-cache curl wget zip unzip git bash --virtual build-dependencies build-base\ | ||
git \ | ||
graphviz \ | ||
python3 \ | ||
ruby-dev \ | ||
py-pygments \ | ||
yaml-dev \ | ||
ttf-dejavu | ||
RUN gem update --system | ||
RUN gem install rdoc --no-document | ||
RUN gem install pygments.rb | ||
|
||
WORKDIR /opt | ||
RUN wget https://github.com/jgm/pandoc/releases/download/3.0.1/pandoc-3.0.1-linux-amd64.tar.gz -O /opt/pandoc.tar.gz | ||
RUN tar -xzf /opt/pandoc.tar.gz -C /opt | ||
RUN rm /opt/pandoc.tar.gz | ||
ENV PATH=$PATH:/opt/pandoc-3.0.1/bin/ | ||
|
||
USER dtcuser | ||
WORKDIR /home/dtcuser | ||
ENV HOME=/home/dtcuser | ||
|
||
ENV GRADLE_USER_HOME=/home/dtcuser/.gradle | ||
|
||
ARG DTC_VERSION | ||
RUN git clone --branch ng https://github.com/docToolchain/docToolchain.git && \ | ||
cd docToolchain && \ | ||
git fetch --tags && \ | ||
git checkout ${DTC_VERSION} && \ | ||
git submodule update -i && \ | ||
# remove .git folders | ||
rm -rf `find -type d -name .git` && \ | ||
umask g+w && \ | ||
./gradlew downloadDependencies && \ | ||
chmod -R o=u $GRADLE_USER_HOME && \ | ||
chmod -R g=u $GRADLE_USER_HOME && \ | ||
rm -r $GRADLE_USER_HOME/daemon && \ | ||
chmod -R o=u $HOME | ||
|
||
# add reveal.js | ||
RUN cd /home/dtcuser/docToolchain/resources/. && \ | ||
./clone.sh && \ | ||
cd - | ||
|
||
ENV PATH="/home/dtcuser/docToolchain/bin:${PATH}" | ||
|
||
USER dtcuser | ||
|
||
WORKDIR /project | ||
|
||
VOLUME /project | ||
|
||
ENTRYPOINT /bin/bash |