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 410b6c8 commit cced96b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 37 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- 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
Expand Down
47 changes: 11 additions & 36 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,47 +1,23 @@
ARG GOLANG_VERSION=1.20.8
FROM golang:${GOLANG_VERSION}-bullseye as builder
ARG GOLANG_VERSION=1.21.4
FROM golang:${GOLANG_VERSION}-bookworm as builder

ARG VIPS_VERSION=8.14.5
ARG CGIF_VERSION=0.3.0
ARG LIBSPNG_VERSION=0.7.3
ARG TARGETARCH

ENV PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

# 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 liblcms2-dev \
libgsf-1-dev fftw3-dev liborc-0.4-dev librsvg2-dev libimagequant-dev libaom-dev/bullseye-backports libheif-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 && \
libgsf-1-dev libfftw3-dev liborc-0.4-dev librsvg2-dev libimagequant-dev libaom-dev \
libheif-dev libspng-dev libcgif-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 All @@ -57,7 +33,6 @@ RUN DEBIAN_FRONTEND=noninteractive \
ninja -C _build && \
ninja -C _build install && \
ldconfig && \
rm -rf /usr/local/lib/python* && \
rm -rf /usr/local/lib/libvips-cpp.* && \
rm -rf /usr/local/lib/*.a && \
rm -rf /usr/local/lib/*.la
Expand All @@ -74,21 +49,21 @@ COPY . .
RUN if [ "$TARGETARCH" = "amd64" ]; then go test ./...; fi
RUN go build -o ${GOPATH}/bin/imagor ./cmd/imagor/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 && \
libgsf-1-114 libfftw3-bin liborc-0.4-0 librsvg2-2 libcfitsio10 libimagequant0 libaom3 libheif1 \
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 cced96b

Please sign in to comment.