Add image compression to Dockerfile using optipng and jpegoptim for optimized asset handling; update build dependencies.
All checks were successful
Dynamic Branch Deploy / build-and-deploy (push) Successful in 5m33s
All checks were successful
Dynamic Branch Deploy / build-and-deploy (push) Successful in 5m33s
This commit is contained in:
10
Dockerfile
10
Dockerfile
@@ -1,8 +1,8 @@
|
||||
# Stage 1: Builder
|
||||
FROM golang:1.25.5-alpine AS builder
|
||||
|
||||
# Build-Dependencies (bash für das Cache-Version-Skript)
|
||||
RUN apk add --no-cache git bash sed
|
||||
# Build-Dependencies (bash für das Cache-Version-Skript + optipng/jpegoptim für Bildkompression)
|
||||
RUN apk add --no-cache git bash sed optipng jpegoptim
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
@@ -25,6 +25,12 @@ RUN if [ ! -f cmd/client/web/assets/assets.json ]; then \
|
||||
RUN chmod +x scripts/cache-version.sh && \
|
||||
./scripts/cache-version.sh
|
||||
|
||||
# Bilder komprimieren (verlustfrei für PNG, leichter Verlust für JPG)
|
||||
RUN echo "🗜️ Komprimiere Bilder..." && \
|
||||
find cmd/client/web -type f -name "*.png" -exec optipng -o2 -strip all {} \; && \
|
||||
find cmd/client/web -type f \( -name "*.jpg" -o -name "*.jpeg" \) -exec jpegoptim --strip-all -m85 {} \; && \
|
||||
echo "✅ Bildkompression abgeschlossen"
|
||||
|
||||
# Server binary bauen
|
||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo -ldflags="-w -s" -o server ./cmd/server
|
||||
|
||||
|
||||
Reference in New Issue
Block a user