Skip to content

Instantly share code, notes, and snippets.

@lurodrig
Created April 29, 2022 07:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lurodrig/25f5a4b2804027ff67b48cde4ae35568 to your computer and use it in GitHub Desktop.
Save lurodrig/25f5a4b2804027ff67b48cde4ae35568 to your computer and use it in GitHub Desktop.
Dockerfile for building pdfjs component for alfresco share
FROM alpine:3.15.4
RUN apk add -U curl \
&& apk add -U unzip \
&& rm -rf /var/cache/apk/*
# Download the latest release of pdfjs from github:
RUN curl --request GET -sL \
--url 'https://github.com/mozilla/pdf.js/releases/download/v2.13.216/pdfjs-2.13.216-dist.zip' \
--output '/tmp/pdfjs-2.13.216-dist.zip'
RUN unzip /tmp/pdfjs-2.13.216-dist.zip -d /tmp
RUN mkdir -p /tmp/pdfjs
RUN mv /tmp/build/* /tmp/pdfjs/
RUN mv /tmp/web/cmaps /tmp/pdfjs/
# sed kung-fu is needed to export the pdfjs module vars. Upstream pdf.js assumes is is deploed under pdfjs-dist/build/pdf
RUN sed -i 's/pdfjs-dist\/build\/pdf/\/share\/res\/components\/preview\/pdfjs\/pdf.js/g' /tmp/pdfjs/pdf.js
RUN sed -i 's/pdfjs-dist\/build\/pdf.worker/\/share\/res\/components\/preview\/pdfjs\/pdf.worker.js/g' /tmp/pdfjs/pdf.worker.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment