mirror of
https://github.com/astefanutti/decktape.git
synced 2024-09-11 14:25:44 +03:00
Use multi-stage Docker build
This commit is contained in:
parent
f38cd6165f
commit
40458eaa66
@ -3,3 +3,4 @@
|
|||||||
!plugins
|
!plugins
|
||||||
!decktape.js
|
!decktape.js
|
||||||
!package.json
|
!package.json
|
||||||
|
!package-lock.json
|
||||||
|
59
Dockerfile
59
Dockerfile
@ -1,42 +1,53 @@
|
|||||||
FROM node:9-alpine
|
FROM node:9-alpine as builder
|
||||||
|
|
||||||
ENV NODE_ENV production
|
ENV NODE_ENV production
|
||||||
ENV TERM xterm-color
|
|
||||||
|
|
||||||
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
|
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
|
||||||
|
|
||||||
|
RUN apk add --no-cache --virtual .gyp python make g++
|
||||||
|
|
||||||
|
WORKDIR /decktape
|
||||||
|
|
||||||
|
COPY package.json package-lock.json ./
|
||||||
|
COPY libs libs/
|
||||||
|
COPY plugins plugins/
|
||||||
|
COPY decktape.js ./
|
||||||
|
|
||||||
|
RUN npm install && \
|
||||||
|
rm -rf node_modules/hummus/src && \
|
||||||
|
rm -rf node_modules/hummus/build
|
||||||
|
|
||||||
|
FROM alpine:3.7
|
||||||
|
|
||||||
|
ENV TERM xterm-color
|
||||||
|
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
|
||||||
|
|
||||||
|
# Chromium
|
||||||
# https://git.alpinelinux.org/cgit/aports/log/community/chromium
|
# https://git.alpinelinux.org/cgit/aports/log/community/chromium
|
||||||
RUN apk add --no-cache ca-certificates ttf-freefont && \
|
RUN apk add --no-cache ca-certificates ttf-freefont && \
|
||||||
apk add --no-cache chromium --repository http://dl-cdn.alpinelinux.org/alpine/edge/community && \
|
apk add --no-cache chromium --repository http://dl-cdn.alpinelinux.org/alpine/edge/community && \
|
||||||
rm -rf /var/cache/apk/*
|
rm -rf /var/cache/apk/*
|
||||||
|
|
||||||
WORKDIR /decktape
|
# Node.js
|
||||||
|
COPY --from=builder /usr/local/bin/node /usr/local/bin/
|
||||||
|
|
||||||
COPY package.json ./
|
# DeckTape
|
||||||
COPY libs libs/
|
COPY --from=builder /decktape /decktape
|
||||||
COPY plugins plugins/
|
|
||||||
COPY decktape.js ./
|
|
||||||
|
|
||||||
RUN apk add --no-cache --virtual .gyp python make g++ && \
|
RUN addgroup -g 1000 node && \
|
||||||
npm install --production && \
|
adduser -u 1000 -G node -s /bin/sh -D node && \
|
||||||
apk del .gyp && \
|
mkdir /slides && \
|
||||||
rm -rf node_modules/hummus/src && \
|
chown node:node /slides
|
||||||
rm -rf node_modules/hummus/build && \
|
|
||||||
rm -rf /root/.node-gyp && \
|
|
||||||
rm -rf /root/.npm && \
|
|
||||||
rm -rf /var/cache/apk/* && \
|
|
||||||
chown -R node:node /decktape
|
|
||||||
|
|
||||||
# https://github.com/moby/moby/issues/20295
|
|
||||||
RUN mkdir /slides && \
|
|
||||||
chown -R node:node /slides
|
|
||||||
|
|
||||||
USER node
|
|
||||||
|
|
||||||
WORKDIR /slides
|
WORKDIR /slides
|
||||||
|
|
||||||
# The --no-sandbox option is required for the moment
|
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
|
# https://github.com/GoogleChrome/puppeteer/issues/290
|
||||||
|
# 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"]
|
ENTRYPOINT ["node", "/decktape/decktape.js", "--no-sandbox", "--executablePath", "chromium-browser"]
|
||||||
|
|
||||||
CMD ["-h"]
|
CMD ["-h"]
|
||||||
|
Loading…
Reference in New Issue
Block a user