fork of gh:maxwoffard/pic-to-patch
1.8 kB
48 lines
1# Stage 1: build Go binary
2FROM golang:1.26-alpine AS go-builder
3WORKDIR /src
4COPY worker/go.mod worker/go.sum ./
5RUN go mod download
6COPY worker/*.go ./
7RUN CGO_ENABLED=0 go build -o /worker .
8
9# Stage 2: build vtracer from Rust source
10FROM rust:1-slim AS rust-builder
11RUN cargo install vtracer
12
13# Stage 3: download and strip inkstitch
14FROM debian:trixie-slim AS inkstitch-builder
15RUN apt-get update && apt-get install -y --no-install-recommends \
16 wget xz-utils ca-certificates \
17 && rm -rf /var/lib/apt/lists/*
18
19ARG INKSTITCH_VERSION=3.2.2
20RUN ARCH=$(dpkg --print-architecture) && \
21 if [ "$ARCH" = "arm64" ]; then INKARCH="aarch64"; else INKARCH="x86_64"; fi && \
22 wget -q "https://github.com/inkstitch/inkstitch/releases/download/v${INKSTITCH_VERSION}/inkstitch-${INKSTITCH_VERSION}-linux-${INKARCH}.tar.xz" \
23 -O /tmp/inkstitch.tar.xz && \
24 mkdir -p /opt/inkstitch && \
25 tar xJf /tmp/inkstitch.tar.xz -C /opt/inkstitch && \
26 rm /tmp/inkstitch.tar.xz && \
27 rm -rf /opt/inkstitch/inkstitch/fonts \
28 /opt/inkstitch/inkstitch/bin/locales \
29 /opt/inkstitch/inkstitch/inx \
30 /opt/inkstitch/inkstitch/palettes \
31 /opt/inkstitch/inkstitch/tiles \
32 /opt/inkstitch/inkstitch/addons \
33 /opt/inkstitch/inkstitch/symbols \
34 /opt/inkstitch/inkstitch/dbus
35
36# Stage 4: runtime (no Python!)
37FROM debian:trixie-slim
38
39RUN apt-get update && apt-get install -y --no-install-recommends \
40 inkscape libwayland-cursor0 libdrm2 libgbm1 libxcb-dri3-0 \
41 && rm -rf /var/lib/apt/lists/*
42
43COPY --from=go-builder /worker /usr/local/bin/worker
44COPY --from=rust-builder /usr/local/cargo/bin/vtracer /usr/local/bin/vtracer
45COPY --from=inkstitch-builder /opt/inkstitch /opt/inkstitch
46ENV INKSTITCH_BIN=/opt/inkstitch/inkstitch/bin/inkstitch
47
48CMD ["worker"]