split up layers for dependencys

This commit is contained in:
2026-03-03 19:08:50 +01:00
parent 22a320f00d
commit 60a1a9b0e9

View File

@@ -1,20 +1,26 @@
FROM golang:1.24.2
FROM golang:1.26.0 AS builder
WORKDIR /app
RUN apt-get update && apt-get install -y \
imagemagick \
ffmpeg \
poppler-utils \
ocrmypdf \
qpdf \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /build
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN go build -o /app/thumbnail-service
FROM debian:bookworm-slim
WORKDIR /app
RUN apt-get update
RUN apt-get install -y --no-install-recommends imagemagick
RUN apt-get install -y --no-install-recommends ffmpeg
RUN apt-get install -y --no-install-recommends poppler-utils
RUN apt-get install -y --no-install-recommends qpdf
RUN apt-get install -y --no-install-recommends ocrmypdf
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
COPY --from=builder /app/thumbnail-service .
EXPOSE 50051
RUN go mod tidy && go build -o thumbnail-service
CMD ["./thumbnail-service"]
CMD ["./thumbnail-service"]