1- # Use Debian Bullseye as a base image to link against glibc 2.31.
2- FROM public.ecr.aws/debian/debian:bullseye-slim AS base
1+ # Base image for building imgproxy and its dependencies.
2+ ARG BASE_IMAGE=public.ecr.aws/ubuntu/ubuntu:22.04
3+
4+ # Use ubuntu 22.04 as a base image to link against glibc 2.35.
5+ FROM ${BASE_IMAGE} AS base
36
47RUN apt-get update \
58 && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
@@ -28,7 +31,8 @@ FROM base AS deps
2831
2932COPY install-rust.sh ./
3033
31- RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
34+ RUN apt-get update \
35+ && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
3236 autoconf \
3337 autopoint \
3438 automake \
@@ -62,24 +66,52 @@ RUN ./install-go.sh
6266
6367# ==============================================================================
6468
65- FROM public.ecr.aws/debian/debian:bullseye-slim AS final
69+ FROM ${BASE_IMAGE} AS final
6670LABEL maintainer="Sergey Alexandrovich <darthsim@gmail.com>"
6771
6872RUN apt-get update \
6973 && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
7074 bash \
7175 curl \
72- git \
7376 ca-certificates \
7477 build-essential \
7578 pkg-config \
7679 libssl-dev \
77- libstdc++-10-dev
80+ libstdc++-10-dev \
81+ software-properties-common \
82+ gpg-agent \
83+ && apt-get clean \
84+ && truncate -s 0 /var/log/*log \
85+ && rm -rf /tmp/* \
86+ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
87+
88+ # Install LLVM 20 (for clang-format) and latest git (custom, newer versions)
89+ RUN echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-20 main" > /etc/apt/sources.list.d/llvm20.list \
90+ && curl -sSL https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
91+
92+ RUN apt-add-repository ppa:git-core/ppa
93+
94+ RUN apt-get update \
95+ && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
96+ git \
97+ clang-format \
98+ && apt-get clean \
99+ && truncate -s 0 /var/log/*log \
100+ && rm -rf /tmp/* \
101+ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
78102
79103WORKDIR /root
80104
81105COPY --from=golang /usr/local/go /usr/local/go
82- ENV PATH=$PATH:/usr/local/go/bin
106+ ENV PATH=$PATH:/usr/local/go/bin:/root/go/bin
107+
108+ RUN go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.5.0 \
109+ && go install github.com/evilmartians/lefthook@latest \
110+ && go install gotest.tools/gotestsum@latest \
111+ && go install github.com/air-verse/air@latest \
112+ && go clean -cache -modcache
113+
114+ COPY --from=deps /root/deps/lychee/lychee /usr/local/bin/lychee
83115
84116COPY --from=deps /opt/imgproxy/lib /opt/imgproxy/lib
85117COPY --from=deps /opt/imgproxy/include /opt/imgproxy/include
@@ -88,5 +120,7 @@ COPY --from=deps /opt/imgproxy/bin /opt/imgproxy/bin
88120COPY --from=deps /root/.bashrc /root/.bashrc
89121ENV BASH_ENV=/root/.bashrc
90122
123+ ENV IMGPROXY_IN_BASE_CONTAINER=true
124+
91125WORKDIR /app
92126CMD ["bash" ]
0 commit comments