Dockerfile 1.6 KB
Newer Older
1
ARG NODE_VERSION=12
Guillaume Perréal's avatar
Guillaume Perréal committed
2
3
ARG DEBIAN_RELEASE=buster

Guillaume Perréal's avatar
Guillaume Perréal committed
4
FROM node:${NODE_VERSION}-${DEBIAN_RELEASE}
Guillaume Perréal's avatar
Guillaume Perréal committed
5
6
7

RUN apt-get update -yq \
    && apt-get install -yq --no-install-recommends \
8
9
10
11
12
13
14
    ca-certificates \
    fontconfig \
    libjpeg62-turbo \
    libx11-6 \
    libxcb1 \
    libxext6 \
    libxrender1 \
Guillaume Perréal's avatar
Guillaume Perréal committed
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
    wget \
    xfonts-75dpi \
    xfonts-base \
    && find /var/*/apt -type f -delete

ARG PANDOC_VERSION=2.9.2.1
RUN wget -nv -O /tmp/pandoc.tar.gz https://github.com/jgm/pandoc/releases/download/${PANDOC_VERSION}/pandoc-${PANDOC_VERSION}-linux-amd64.tar.gz \
    && cd /usr/local \
    && tar xfz /tmp/pandoc.tar.gz --strip-components=1 \
    && rm /tmp/pandoc.tar.gz \
    && pandoc --version

ARG WKHTMLTOPDF_VERSION=0.12.5
ARG DEBIAN_RELEASE=buster
RUN wget -nv -O /tmp/wkhtmltox.deb https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/${WKHTMLTOPDF_VERSION}/wkhtmltox_${WKHTMLTOPDF_VERSION}-1.${DEBIAN_RELEASE}_amd64.deb \
    && dpkg -i /tmp/wkhtmltox.deb \
    && rm /tmp/wkhtmltox.deb \
    && wkhtmltopdf --version

RUN mkdir -p /src /opt/prezbuilder
COPY src/ /src/
COPY assets/ /opt/prezbuilder/assets/
COPY lib/ /opt/prezbuilder/lib/
COPY gulpfile.esm.js package.json package-lock.json /opt/prezbuilder/

ENV NODE_ENV=production
RUN cd /opt/prezbuilder/ \
Guillaume Perréal's avatar
Guillaume Perréal committed
42
    && env NPM_CONFIG_CACHE=/tmp/.npm npm install \
Guillaume Perréal's avatar
Guillaume Perréal committed
43
44
45
46
47
48
    && rm -rf /tmp/.npm

ENV SERVER_HOST=0.0.0.0 \
    SERVER_PORT=3000 \
    SRC=/src \
    OUTPUT=/public \
49
    WKHTMLTOPDF_BINARY=/usr/local/bin/wkhtmltopdf
Guillaume Perréal's avatar
Guillaume Perréal committed
50
51
52
53
54
55
56
57

RUN mkdir -p -m 0777 $OUTPUT

WORKDIR /opt/prezbuilder
EXPOSE 3000/tcp 35729/tcp

ENTRYPOINT ["/opt/prezbuilder/node_modules/.bin/gulp"]
CMD ["dev"]