|
| 1 | +# This Dockerfile is way more complex than it should be thanks to a bug in the |
| 2 | +# Mintlify CLI: It does not fail when it discovers parsing errors in .mdx |
| 3 | +# files that are not (yet) referenced by docs.json. |
| 4 | +# We work around this issue by running mint via script(1) - unlike tee(1) it |
| 5 | +# is able to redirect output to a file while preserving colored output in the |
| 6 | +# terminal. Then we check the file contents for actual parsing errors. |
| 7 | +# Unfortunately the newest readily available version of script is too old, |
| 8 | +# so we need to build our own binary (called script2) in the build stage. |
| 9 | + |
| 10 | +# Build stage |
| 11 | +FROM gcr.io/bazel-public/ubuntu2404 AS builder |
| 12 | + |
| 13 | +# Install build dependencies |
| 14 | +RUN apt-get update && apt-get install -y \ |
| 15 | + wget \ |
| 16 | + build-essential \ |
| 17 | + tar \ |
| 18 | + && rm -rf /var/lib/apt/lists/* |
| 19 | + |
| 20 | +WORKDIR /build |
| 21 | + |
| 22 | +# Download, extract, and build util-linux |
| 23 | +RUN wget -c "https://www.kernel.org/pub/linux/utils/util-linux/v2.42/util-linux-2.42.1.tar.gz" -O util-linux.tar.gz \ |
| 24 | + && tar -xzvf util-linux.tar.gz \ |
| 25 | + && cd util-linux-2.42.1 \ |
| 26 | + && ./configure --disable-all-programs --enable-scriptutils \ |
| 27 | + && make |
| 28 | + |
1 | 29 | # Use the Bazel public image as the base |
2 | 30 | FROM gcr.io/bazel-public/ubuntu2404 |
3 | 31 |
|
4 | 32 | # Install dependencies: jq and deps of nodejs |
5 | 33 | RUN apt-get update && apt-get install -y \ |
6 | 34 | jq ca-certificates curl gnupg |
7 | 35 |
|
| 36 | +# Copy the compiled binary from the builder stage |
| 37 | +COPY --from=builder /build/util-linux-2.42.1/script /usr/bin/script2 |
| 38 | + |
| 39 | +# Ensure it's executable |
| 40 | +RUN chmod +x /usr/bin/script2 |
| 41 | + |
8 | 42 | # Install nodejs as per https://github.com/nodesource/distributions/wiki/Repository-Manual-Installation#debian-systems |
9 | 43 | RUN mkdir -p /etc/apt/keyrings && \ |
10 | 44 | curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \ |
|
0 commit comments