From 02b492fe647c4e99ba7e179ca60fea73340de656 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Mon, 23 Dec 2024 18:19:45 -0700 Subject: [PATCH] Upgrade alpine & libheif version (#632) --- .github/workflows/build-libheif.sh | 2 +- CHANGELOG.md | 1 + Dockerfile | 24 ++++++++++++++++++------ go.mod | 4 ++-- go.sum | 4 ++-- 5 files changed, 24 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build-libheif.sh b/.github/workflows/build-libheif.sh index 95699140..e3b5f0d6 100644 --- a/.github/workflows/build-libheif.sh +++ b/.github/workflows/build-libheif.sh @@ -3,7 +3,7 @@ set -ex sudo apt-get install -y git cmake make pkg-config libx265-dev libde265-dev libjpeg-dev libtool git clone https://github.com/strukturag/libheif.git cd libheif -git checkout v1.17.6 +git checkout v1.19.5 mkdir build cd build cmake --preset=release .. diff --git a/CHANGELOG.md b/CHANGELOG.md index 100102cb..7288601b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ### Changed * MMR now requires Go 1.22 for compilation. +* MMR now builds on a base image of `alpine:3.21`. * The global `repo.freezeUnauthenticatedMedia` option now defaults to `true`, enabling authenticated media by default. A future release will remove this option, requiring the freeze behaviour. See `config.sample.yaml` for details. ### Fixed diff --git a/Dockerfile b/Dockerfile index d27b0b79..288b8588 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,18 +1,16 @@ # ---- Stage 0 ---- # Builds media repo binaries -FROM golang:1.22-alpine3.18 AS builder +FROM golang:1.22-alpine3.21 AS builder # Install build dependencies RUN apk add --no-cache git musl-dev dos2unix build-base libde265-dev -WORKDIR /opt -COPY . /opt - # Build libheif manually +WORKDIR /opt RUN apk add --no-cache build-base libtool cmake libjpeg-turbo-dev x265-dev ffmpeg-dev zlib-dev RUN git clone https://github.com/strukturag/libheif.git WORKDIR /opt/libheif -RUN git checkout v1.17.6 +RUN git checkout v1.19.5 RUN mkdir build WORKDIR /opt/libheif/build RUN cmake --preset=release .. @@ -20,13 +18,15 @@ RUN make RUN make install WORKDIR /opt +COPY . /opt + # Run remaining build steps RUN dos2unix ./build.sh ./docker/run.sh && chmod 744 ./build.sh RUN ./build.sh # ---- Stage 1 ---- # Final runtime stage. -FROM alpine:3.18 +FROM alpine:3.21 RUN mkdir /plugins RUN apk add --no-cache \ @@ -36,6 +36,18 @@ RUN apk add --no-cache \ imagemagick \ ffmpeg +# We have to manually recompile libheif due to musl/alpine weirdness introduced in alpine-3.19 +WORKDIR /opt +RUN apk add --no-cache git libde265-dev musl-dev build-base libtool cmake libjpeg-turbo-dev x265-dev ffmpeg-dev zlib-dev +RUN git clone https://github.com/strukturag/libheif.git +WORKDIR /opt/libheif +RUN git checkout v1.19.5 +RUN mkdir build +WORKDIR /opt/libheif/build +RUN cmake --preset=release .. +RUN make +RUN make install + COPY --from=builder /opt/bin/plugin_antispam_ocr /plugins/ COPY --from=builder \ /opt/bin/media_repo \ diff --git a/go.mod b/go.mod index 8a7c412e..b44febda 100644 --- a/go.mod +++ b/go.mod @@ -45,7 +45,6 @@ require ( require ( github.com/didip/tollbooth/v7 v7.0.2 - github.com/docker/docker v27.4.1+incompatible github.com/docker/go-connections v0.5.0 github.com/go-redsync/redsync/v4 v4.13.0 github.com/julienschmidt/httprouter v1.3.0 @@ -54,7 +53,7 @@ require ( github.com/redis/go-redis/v9 v9.7.0 github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 github.com/stretchr/testify v1.10.0 - github.com/strukturag/libheif v1.17.6 + github.com/strukturag/libheif v1.19.5 github.com/t2bot/go-leaky-bucket v1.0.0 github.com/t2bot/go-singleflight-streams v1.0.0 github.com/t2bot/go-typed-singleflight v0.0.3 @@ -82,6 +81,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect github.com/distribution/reference v0.6.0 // indirect + github.com/docker/docker v27.4.1+incompatible // indirect github.com/docker/go-units v0.5.0 // indirect github.com/dsoprea/go-utility/v2 v2.0.0-20221003172846-a3e1774ef349 // indirect github.com/fatih/color v1.18.0 // indirect diff --git a/go.sum b/go.sum index dc350ba8..f7bbb49c 100644 --- a/go.sum +++ b/go.sum @@ -366,8 +366,8 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/strukturag/libheif v1.17.6 h1:UFz4FI7kKLINWyL7bcNEBu4gZxK7rHRkwq49IOzHyvE= -github.com/strukturag/libheif v1.17.6/go.mod h1:E/PNRlmVtrtj9j2AvBZlrO4dsBDu6KfwDZn7X1Ce8Ks= +github.com/strukturag/libheif v1.19.5 h1:YLf0RO6mNQYeeNkFSk/Uto8EyUOCzDpLPjbEBoeV9Io= +github.com/strukturag/libheif v1.19.5/go.mod h1:E/PNRlmVtrtj9j2AvBZlrO4dsBDu6KfwDZn7X1Ce8Ks= github.com/stvp/tempredis v0.0.0-20181119212430-b82af8480203 h1:QVqDTf3h2WHt08YuiTGPZLls0Wq99X9bWd0Q5ZSBesM= github.com/stvp/tempredis v0.0.0-20181119212430-b82af8480203/go.mod h1:oqN97ltKNihBbwlX8dLpwxCl3+HnXKV/R0e+sRLd9C8= github.com/t2bot/go-leaky-bucket v1.0.0 h1:w16tqQj4pslBFNc8xEYvOcu5rt8QhLugx1e5TKyT9zI=