Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add libreoffice microservice #8

Merged
merged 3 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions .github/workflows/build-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,13 @@ jobs:
# aka base build
if [ ${{ inputs.dockerFile }} == "Dockerfile" ]; then
echo "image=scyllaridae" >> $GITHUB_OUTPUT
echo "context=." >> $GITHUB_OUTPUT
exit 0
fi

# put the YML file in place so it's copied into the Docker container
DIR=$(dirname "${{ inputs.dockerFile }}")
cp ./$DIR/scyllaridae.yml .
# name the docker image after the folder name prefixed by scyllaridae
# e.g. scyllaridae-curl
echo "image=scyllaridae-$(basename $DIR)" >> $GITHUB_OUTPUT
echo "context=$DIR" >> $GITHUB_OUTPUT
id: setup

- id: 'auth'
Expand All @@ -71,8 +69,7 @@ jobs:
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: ${{ inputs.dockerFile }}
context: ${{steps.setup.outputs.context}}
build-args: |
TAG=${{steps.extract_branch.outputs.branch}}
DOCKER_REPOSITORY=us-docker.pkg.dev/${{ secrets.GCLOUD_PROJECT }}/public
Expand Down
12 changes: 12 additions & 0 deletions docker-images/libreoffice/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
ARG TAG=main
ARG DOCKER_REPOSITORY=local
FROM ${DOCKER_REPOSITORY}/scyllaridae:${TAG} AS scyllaridae

COPY scyllaridae.yml /app/
COPY docker-entrypoint.sh /app/

RUN apk update && \
apk add --no-cache \
openjdk17-jre==17.0.11_p9-r0 \
libreoffice==7.6.3.1-r0 \
ttf-dejavu==2.37-r5
16 changes: 16 additions & 0 deletions docker-images/libreoffice/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash

# take input from stdin and print to stdout

set -eou pipefail

input_temp=$(mktemp /tmp/libreoffice-input-XXXXXX)

cat > "$input_temp"

libreoffice --headless --convert-to pdf "$input_temp" > /dev/null 2>&1

PDF="$(basename "$input_temp").pdf"
cat "/app/$PDF"

rm "$input_temp" "/app/$PDF"
10 changes: 10 additions & 0 deletions docker-images/libreoffice/scyllaridae.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
allowedMimeTypes:
- "application/msword"
- "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
- "application/vnd.ms-powerpoint"
- "application/vnd.openxmlformats-officedocument.presentationml.presentation"
- "application/vnd.ms-excel"
- "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
cmdByMimeType:
default:
cmd: /app/docker-entrypoint.sh
Loading