decktape/Dockerfile

60 lines
2.0 KiB
Docker
Raw Normal View History

FROM node:10-alpine as builder
2015-11-13 06:53:55 +03:00
ENV NODE_ENV production
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
2018-02-28 16:26:21 +03:00
RUN apk add --no-cache --virtual .gyp python make g++
2015-11-13 06:53:55 +03:00
WORKDIR /decktape
2018-04-26 13:26:34 +03:00
COPY package.json npm-shrinkwrap.json ./
COPY libs libs/
COPY plugins plugins/
COPY decktape.js ./
# Force HummusJS build from source
# See https://github.com/galkahana/HummusJS/issues/230
2018-02-28 16:26:21 +03:00
RUN npm install && \
node_modules/hummus/node_modules/.bin/node-pre-gyp clean install --build-from-source -C node_modules/hummus/ && \
rm -rf node_modules/hummus/src && \
2018-02-28 16:26:21 +03:00
rm -rf node_modules/hummus/build
FROM alpine:3.8
2018-02-28 16:26:21 +03:00
ENV TERM xterm-color
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
# Chromium
# https://git.alpinelinux.org/cgit/aports/log/community/chromium
RUN apk add --no-cache ca-certificates ttf-freefont && \
apk add --no-cache chromium --repository http://dl-cdn.alpinelinux.org/alpine/edge/community && \
2018-07-11 20:52:30 +03:00
apk add --no-cache wqy-zenhei --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing && \
# /etc/fonts/conf.d/44-wqy-zenhei.conf overrides 'monospace' matching FreeMono.ttf in /etc/fonts/conf.d/69-unifont.conf
mv /etc/fonts/conf.d/44-wqy-zenhei.conf /etc/fonts/conf.d/74-wqy-zenhei.conf && \
2018-02-28 16:26:21 +03:00
rm -rf /var/cache/apk/*
# Node.js
COPY --from=builder /usr/local/bin/node /usr/local/bin/
# DeckTape
COPY --from=builder /decktape /decktape
RUN addgroup -g 1000 node && \
adduser -u 1000 -G node -s /bin/sh -D node && \
mkdir /slides && \
chown node:node /slides
WORKDIR /slides
2018-02-28 16:26:21 +03:00
USER node
# The --no-sandbox option is required, or --cap-add=SYS_ADMIN to docker run command
# https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md#running-puppeteer-in-docker
# https://github.com/GoogleChrome/puppeteer/issues/290
2018-02-28 16:26:21 +03:00
# https://github.com/jessfraz/dockerfiles/issues/65
# https://github.com/jessfraz/dockerfiles/issues/156
# https://github.com/jessfraz/dockerfiles/issues/341
ENTRYPOINT ["node", "/decktape/decktape.js", "--no-sandbox", "--executablePath", "chromium-browser"]
2015-11-22 21:06:53 +03:00
CMD ["-h"]