50 lines
1.7 KiB
Docker
50 lines
1.7 KiB
Docker
# syntax=docker/dockerfile:1
|
|
|
|
ARG TARGETARCH
|
|
FROM debian:trixie-slim AS runtime
|
|
ARG TARGETARCH
|
|
WORKDIR /app
|
|
|
|
RUN set -eux; \
|
|
apt-get update; \
|
|
apt-get install -y --no-install-recommends \
|
|
ca-certificates \
|
|
curl \
|
|
libssl3 \
|
|
libpq5 \
|
|
libjpeg62-turbo \
|
|
libpng16-16 \
|
|
ocrmypdf \
|
|
tesseract-ocr \
|
|
ghostscript \
|
|
qpdf; \
|
|
rm -rf /var/lib/apt/lists/*; \
|
|
case "$TARGETARCH" in \
|
|
amd64) pdf_pkg=pdfium-linux-x64.tgz ;; \
|
|
arm64) pdf_pkg=pdfium-linux-arm64.tgz ;; \
|
|
*) echo "Unsupported architecture: $TARGETARCH" >&2; exit 1 ;; \
|
|
esac; \
|
|
curl -fsSL "https://github.com/bblanchon/pdfium-binaries/releases/latest/download/${pdf_pkg}" -o /tmp/pdfium.tgz; \
|
|
mkdir -p /tmp/pdfium; \
|
|
tar -xzf /tmp/pdfium.tgz -C /tmp/pdfium --strip-components=1; \
|
|
pdfium_so="$(find /tmp/pdfium -name libpdfium.so -type f | head -n1)"; \
|
|
[ -n "$pdfium_so" ]; \
|
|
mv "$pdfium_so" /usr/local/lib/libpdfium.so; \
|
|
ldconfig; \
|
|
rm -rf /tmp/pdfium /tmp/pdfium.tgz; \
|
|
useradd --system --create-home --uid 10001 appuser
|
|
|
|
COPY build-artifacts/backend/${TARGETARCH}/papercrate-backend /usr/local/bin/papercrate-backend
|
|
COPY build-artifacts/backend/${TARGETARCH}/papercrate-worker /usr/local/bin/papercrate-worker
|
|
COPY build-artifacts/backend/${TARGETARCH}/papercrate-webdav /usr/local/bin/papercrate-webdav
|
|
COPY build-artifacts/backend/${TARGETARCH}/papercrate-admin /usr/local/bin/papercrate-admin
|
|
COPY build-artifacts/backend/${TARGETARCH}/diesel /usr/local/bin/diesel
|
|
|
|
COPY migrations ./migrations
|
|
COPY diesel.toml ./
|
|
|
|
ENV RUST_LOG=info
|
|
USER appuser
|
|
EXPOSE 3000
|
|
ENTRYPOINT ["/usr/local/bin/papercrate-backend"]
|