-
-
Notifications
You must be signed in to change notification settings - Fork 92
Expand file tree
/
Copy pathDockerfile
More file actions
51 lines (38 loc) · 1.92 KB
/
Copy pathDockerfile
File metadata and controls
51 lines (38 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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
42
43
44
45
46
47
48
49
50
51
# Build the SEA binary
FROM node:24-bookworm-slim AS builder
# Chrome system libs are required by the smoke test that runs at the end of npm run build
RUN apt-get update \
&& apt-get install -y chromium unzip \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY package.json package-lock.json ./
RUN PUPPETEER_SKIP_DOWNLOAD=true npm ci --cache /tmp/npm-cache && rm -rf /tmp/npm-cache
COPY lib ./lib
COPY bin ./bin
COPY css ./css
COPY examples ./examples
COPY fonts ./fonts
COPY tasks ./tasks
RUN npm run build && \
PLATFORM_DIR=$(find build -maxdepth 1 -type d \( -name 'linux-x64' -o -name 'linux-arm64' \) | head -1) && \
test -n "$PLATFORM_DIR" && mv "$PLATFORM_DIR" build/output
# Create the final image
# Must use a glibc-based image (Debian/Ubuntu): the SEA binary embeds the Node.js runtime
# which is compiled against glibc. Alpine uses musl and cannot run the binary.
FROM debian:bookworm-slim
RUN addgroup --gid 1000 asciidoctor && adduser --disabled-password --ingroup asciidoctor -u 1000 asciidoctor
RUN apt-get update \
&& apt-get install -y chromium fonts-noto-color-emoji fonts-freefont-ttf \
&& fc-cache -f \
&& rm -rf /var/lib/apt/lists/*
COPY --chown=asciidoctor:asciidoctor --from=builder /app/build/output/asciidoctor-web-pdf /usr/bin/asciidoctor-web-pdf
COPY --chown=asciidoctor:asciidoctor --from=builder /app/build/output/viewer/ /usr/bin/viewer/
COPY --chown=asciidoctor:asciidoctor --from=builder /app/build/output/assets/ /usr/bin/assets/
COPY --chown=asciidoctor:asciidoctor --from=builder /app/build/output/css/ /usr/bin/css/
COPY --chown=asciidoctor:asciidoctor --from=builder /app/build/output/examples/ /usr/bin/examples/
COPY --chown=asciidoctor:asciidoctor --from=builder /app/build/output/fonts/ /usr/bin/fonts/
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
RUN mkdir /usr/app && chown asciidoctor:asciidoctor /usr/app
USER asciidoctor
WORKDIR /usr/app
ENTRYPOINT ["/usr/bin/asciidoctor-web-pdf"]