Image build: mkdir the directories the RUN steps write into

0074a50 · Gabriel Morell · 2026-09-26 04:05

1 files +7 -0
Message
{commit_body(@commit)}

Files changed

modified Dockerfile
+7 −0
@@ -32,6 +32,10 @@ RUN cd assets \
32 32 # (Cargo.toml/Cargo.lock first, then src) still helps local rebuilds.
33 33 # ---------------------------------------------------------------------------
34 34 FROM rust:1.92-bookworm AS rust-builder
35 +# mkdir in a RUN rather than letting WORKDIR create it: on the forge's
36 +# BuildKit runner a WORKDIR-created directory isn't writable by the RUN
37 +# steps' root, and cargo writes target/ straight into it.
38 +RUN mkdir -p /app
35 39 WORKDIR /app
36 40
37 41 RUN apt-get update \
@@ -68,6 +72,9 @@ FROM debian:bookworm-slim AS ocr-models
68 72 RUN apt-get update \
69 73 && apt-get install -y --no-install-recommends ca-certificates curl \
70 74 && rm -rf /var/lib/apt/lists/*
75 +# Same WORKDIR caveat as rust-builder: curl got "Permission denied" writing
76 +# into a WORKDIR-created /models there.
77 +RUN mkdir -p /models
71 78 WORKDIR /models
72 79 RUN curl -fL --retry 3 -o text-detection.rten https://ocrs-models.s3-accelerate.amazonaws.com/text-detection.rten \
73 80 && curl -fL --retry 3 -o text-recognition.rten https://ocrs-models.s3-accelerate.amazonaws.com/text-recognition.rten

Parents: 77b4bae