This commit is contained in:
Tomas Dvorak
2026-03-13 15:03:11 +01:00
parent 30d70a6aeb
commit 4ca3f4ff53
3 changed files with 10 additions and 7 deletions
+4 -3
View File
@@ -1,5 +1,6 @@
# Build stage
FROM golang:1.24.5-bullseye AS builder
ARG GO_IMAGE_TAG=1.25.8-bookworm
FROM golang:${GO_IMAGE_TAG} AS builder
ARG REMBG_ENABLED=true
WORKDIR /app
@@ -33,7 +34,7 @@ RUN --mount=type=cache,target=/go/pkg/mod \
# Install Python dependencies for rembg (before copying full source for better cacheability)
COPY scripts/requirements-rembg.txt .
RUN --mount=type=cache,target=/root/.cache/pip \
if [ "$REMBG_ENABLED" = "true" ]; then pip3 install -r requirements-rembg.txt; else echo "REMBG disabled, skipping pip install"; fi
if [ "$REMBG_ENABLED" = "true" ]; then pip3 install --break-system-packages -r requirements-rembg.txt; else echo "REMBG disabled, skipping pip install"; fi
# Copy the source code
COPY . .
@@ -67,7 +68,7 @@ RUN addgroup --system app && adduser --system --ingroup app app \
# Install rembg and its dependencies
COPY --from=builder /app/requirements-rembg.txt .
RUN --mount=type=cache,target=/root/.cache/pip \
if [ "$REMBG_ENABLED" = "true" ]; then pip3 install -r requirements-rembg.txt; fi \
if [ "$REMBG_ENABLED" = "true" ]; then pip3 install --break-system-packages -r requirements-rembg.txt; fi \
&& rm -f requirements-rembg.txt
# Copy the binary and other files