Skip to content

Commit

Permalink
build(docker): debian bookworm
Browse files Browse the repository at this point in the history
  • Loading branch information
cshum committed Nov 19, 2023
1 parent 80fc850 commit 9211ec5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 46 deletions.
16 changes: 6 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,35 @@ on: [push, pull_request]
jobs:
build:
name: Test
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
env:
CGO_CFLAGS_ALLOW: -Xpreprocessor
VIPS_VERSION: 8.14.3
VIPS_VERSION: 8.14.5
FFMPEG_VERSION: 5.1.2
V: 2
V: 4

steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.20
go-version: ^1.21

- name: Check out code
uses: actions/checkout@v2

- name: Install linux dependencies
run: |
sudo add-apt-repository -y ppa:lovell/cgif
sudo add-apt-repository -y ppa:strukturag/libde265
sudo add-apt-repository -y ppa:strukturag/libheif
sudo apt-get update
sudo apt-get install -y \
python3-pip ninja-build \
glib-2.0-dev libexpat-dev librsvg2-dev libpng-dev \
meson ninja-build \
libglib2.0-dev libexpat-dev librsvg2-dev libpng-dev \
libjpeg-turbo8-dev libimagequant-dev libfftw3-dev \
libpoppler-glib-dev libxml2-dev \
libopenslide-dev libcfitsio-dev liborc-0.4-dev libpango1.0-dev \
libtiff5-dev libgsf-1-dev giflib-tools libwebp-dev libheif-dev \
yasm libx264-dev libx265-dev libnuma-dev libvpx-dev libtheora-dev \
librtmp-dev libvorbis-dev \
libopenjp2-7-dev libcgif-dev
sudo pip3 install meson
- name: Cache libvips
uses: actions/cache@v3
Expand Down
48 changes: 12 additions & 36 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,51 +1,27 @@
ARG GOLANG_VERSION=1.20.6
FROM golang:${GOLANG_VERSION}-bullseye as builder
ARG GOLANG_VERSION=1.21.4
FROM golang:${GOLANG_VERSION}-bookworm as builder

ARG FFMPEG_VERSION=5.1.2
ARG VIPS_VERSION=8.14.3
ARG CGIF_VERSION=0.3.0
ARG LIBSPNG_VERSION=0.7.3
ARG TARGETARCH

ENV PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
ENV MAKEFLAGS="-j8"

# libaom3 is in Debian bullseye-backports
RUN echo 'deb http://deb.debian.org/debian bullseye-backports main' > /etc/apt/sources.list.d/backports.list

# Installs libvips + required libraries
RUN DEBIAN_FRONTEND=noninteractive \
apt-get update && \
apt-get install --no-install-recommends -y \
ca-certificates \
automake build-essential curl \
python3-pip ninja-build pkg-config \
meson ninja-build pkg-config \
gobject-introspection gtk-doc-tools libglib2.0-dev libjpeg62-turbo-dev libpng-dev \
libwebp-dev libtiff5-dev libexif-dev libxml2-dev libpoppler-glib-dev \
libwebp-dev libtiff-dev libexif-dev libxml2-dev libpoppler-glib-dev \
swig libpango1.0-dev libmatio-dev libopenslide-dev libcfitsio-dev libopenjp2-7-dev \
libgsf-1-dev fftw3-dev liborc-0.4-dev librsvg2-dev libimagequant-dev libaom-dev/bullseye-backports libheif-dev \
libgsf-1-dev libfftw3-dev liborc-0.4-dev librsvg2-dev libimagequant-dev libaom-dev libheif-dev \
yasm libx264-dev libx265-dev libnuma-dev libvpx-dev libtheora-dev \
librtmp-dev libvorbis-dev && \
pip3 install meson && \
cd /tmp && \
curl -fsSLO https://github.com/dloebl/cgif/archive/refs/tags/V${CGIF_VERSION}.tar.gz && \
tar xf V${CGIF_VERSION}.tar.gz && \
cd cgif-${CGIF_VERSION} && \
meson build --prefix=/usr/local --libdir=/usr/local/lib --buildtype=release && \
cd build && \
ninja && \
ninja install && \
cd /tmp && \
curl -fsSLO https://github.com/randy408/libspng/archive/refs/tags/v${LIBSPNG_VERSION}.tar.gz && \
tar xf v${LIBSPNG_VERSION}.tar.gz && \
cd libspng-${LIBSPNG_VERSION} && \
meson setup _build \
--buildtype=release \
--strip \
--prefix=/usr/local \
--libdir=lib && \
ninja -C _build && \
ninja -C _build install && \
libspng-dev libcgif-dev librtmp-dev libvorbis-dev && \
cd /tmp && \
curl -fsSLO https://github.com/libvips/libvips/releases/download/v${VIPS_VERSION}/vips-${VIPS_VERSION}.tar.xz && \
tar xf vips-${VIPS_VERSION}.tar.xz && \
Expand Down Expand Up @@ -98,22 +74,22 @@ COPY . .
RUN if [ "$TARGETARCH" = "amd64" ]; then go test ./...; fi
RUN go build -o ${GOPATH}/bin/imagorvideo ./cmd/imagorvideo/main.go

FROM debian:bullseye-slim
FROM debian:bookworm-slim
LABEL maintainer="[email protected]"

COPY --from=builder /usr/local/lib /usr/local/lib
COPY --from=builder /etc/ssl/certs /etc/ssl/certs
COPY --from=builder /etc/apt/sources.list.d/backports.list /etc/apt/sources.list.d/backports.list

# Install runtime dependencies
RUN DEBIAN_FRONTEND=noninteractive \
apt-get update && \
apt-get install --no-install-recommends -y \
procps libglib2.0-0 libjpeg62-turbo libpng16-16 libopenexr25 \
libwebp6 libwebpmux3 libwebpdemux2 libtiff5 libexif12 libxml2 libpoppler-glib8 \
procps libglib2.0-0 libjpeg62-turbo libpng16-16 libopenexr-3-1-30 \
libwebp7 libwebpmux3 libwebpdemux2 libtiff6 libexif12 libxml2 libpoppler-glib8 \
libpango1.0-0 libmatio11 libopenslide0 libopenjp2-7 libjemalloc2 \
libgsf-1-114 fftw3 liborc-0.4-0 librsvg2-2 libcfitsio9 libimagequant0 libaom3 libheif1 \
libx264-dev libx265-dev libnuma-dev libvpx6 libtheora0 libvorbis-dev && \
libgsf-1-114 libfftw3-bin liborc-0.4-0 librsvg2-2 libcfitsio10 libimagequant0 libaom3 libheif1 \
libx264-dev libx265-dev libnuma-dev libvpx6 libtheora0 libvorbis-dev \
libspng0 libcgif0 && \
ln -s /usr/lib/$(uname -m)-linux-gnu/libjemalloc.so.2 /usr/local/lib/libjemalloc.so && \
apt-get autoremove -y && \
apt-get autoclean && \
Expand Down

0 comments on commit 9211ec5

Please sign in to comment.