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 \
@@ -27,7 +30,8 @@ FROM base AS deps
2730
2831COPY install-rust.sh ./
2932
30- RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
33+ RUN apt-get update \
34+ && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
3135 autoconf \
3236 autopoint \
3337 automake \
@@ -61,24 +65,52 @@ RUN ./install-go.sh
6165
6266# ==============================================================================
6367
64- FROM public.ecr.aws/debian/debian:bullseye-slim AS final
68+ FROM ${BASE_IMAGE} AS final
6569LABEL maintainer="Sergey Alexandrovich <darthsim@gmail.com>"
6670
6771RUN apt-get update \
6872 && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
6973 bash \
7074 curl \
71- git \
7275 ca-certificates \
7376 build-essential \
7477 pkg-config \
7578 libssl-dev \
76- libstdc++-10-dev
79+ libstdc++-10-dev \
80+ software-properties-common \
81+ gpg-agent \
82+ && apt-get clean \
83+ && truncate -s 0 /var/log/*log \
84+ && rm -rf /tmp/* \
85+ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
86+
87+ # Install LLVM 20 (for clang-format) and latest git (custom, newer versions)
88+ RUN echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-20 main" > /etc/apt/sources.list.d/llvm20.list \
89+ && curl -sSL https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
90+
91+ RUN apt-add-repository ppa:git-core/ppa
92+
93+ RUN apt-get update \
94+ && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
95+ git \
96+ clang-format \
97+ && apt-get clean \
98+ && truncate -s 0 /var/log/*log \
99+ && rm -rf /tmp/* \
100+ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
77101
78102WORKDIR /root
79103
80104COPY --from=golang /usr/local/go /usr/local/go
81- ENV PATH=$PATH:/usr/local/go/bin
105+ ENV PATH=$PATH:/usr/local/go/bin:/root/go/bin
106+
107+ RUN go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.5.0 \
108+ && go install github.com/evilmartians/lefthook@latest \
109+ && go install gotest.tools/gotestsum@latest \
110+ && go install github.com/air-verse/air@latest \
111+ && go clean -cache -modcache
112+
113+ COPY --from=deps /root/deps/lychee/lychee /usr/local/bin/lychee
82114
83115COPY --from=deps /opt/imgproxy/lib /opt/imgproxy/lib
84116COPY --from=deps /opt/imgproxy/include /opt/imgproxy/include
@@ -87,5 +119,7 @@ COPY --from=deps /opt/imgproxy/bin /opt/imgproxy/bin
87119COPY --from=deps /root/.bashrc /root/.bashrc
88120ENV BASH_ENV=/root/.bashrc
89121
122+ ENV IMGPROXY_IN_BASE_CONTAINER=true
123+
90124WORKDIR /app
91125CMD ["bash" ]
0 commit comments