Skip to content

Commit

Permalink
Upgrade alpine & libheif version (#632)
Browse files Browse the repository at this point in the history
  • Loading branch information
turt2live authored Dec 24, 2024
1 parent 78d9ad2 commit 02b492f
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-libheif.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ..
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 18 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
# ---- 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 ..
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 \
Expand All @@ -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 \
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down

0 comments on commit 02b492f

Please sign in to comment.