-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathDockerfile
More file actions
127 lines (97 loc) · 3.43 KB
/
Dockerfile
File metadata and controls
127 lines (97 loc) · 3.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# Base image for building imgproxy and its dependencies.
ARG BASE_IMAGE=public.ecr.aws/ubuntu/ubuntu:22.04
# Use ubuntu 22.04 as a base image to link against glibc 2.35.
FROM ${BASE_IMAGE} AS base
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
bash \
curl \
git \
ca-certificates \
build-essential \
pkg-config \
libssl-dev \
libstdc++-10-dev
WORKDIR /root
# ==============================================================================
FROM base AS deps-src
COPY versions.sh download-deps.sh ./
RUN ./download-deps.sh
# ==============================================================================
FROM base AS deps
COPY install-rust.sh ./
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
autoconf \
autopoint \
automake \
cmake \
nasm \
libtool \
python3-pip \
python3-venv \
gettext \
gperf \
&& ./install-rust.sh \
&& python3 -m venv /root/.python \
&& /root/.python/bin/pip install meson ninja packaging
COPY versions.sh build-deps.sh build-bash-profile.sh *.patch ./
COPY --from=deps-src /root/deps /root/deps
# We need environment variables that are based on the uname -m output,
# so we have to use a Bash profile instead of ENV
RUN ./build-bash-profile.sh > /root/.bashrc
ENV BASH_ENV=/root/.bashrc
RUN ./build-deps.sh
# ==============================================================================
FROM base AS golang
COPY versions.sh install-go.sh ./
RUN ./install-go.sh
# ==============================================================================
FROM ${BASE_IMAGE} AS final
LABEL maintainer="Sergey Alexandrovich <darthsim@gmail.com>"
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
bash \
curl \
ca-certificates \
build-essential \
pkg-config \
libssl-dev \
libstdc++-10-dev \
software-properties-common \
gpg-agent \
fontconfig-config \
fonts-dejavu-core \
&& apt-get clean \
&& truncate -s 0 /var/log/*log \
&& rm -rf /tmp/* \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Install LLVM 20 (for clang-format) and latest git (custom, newer versions)
RUN echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-20 main" > /etc/apt/sources.list.d/llvm20.list \
&& curl -sSL https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
RUN apt-add-repository ppa:git-core/ppa
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
git \
clang-format \
&& apt-get clean \
&& truncate -s 0 /var/log/*log \
&& rm -rf /tmp/* \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
WORKDIR /root
COPY --from=golang /usr/local/go /usr/local/go
ENV PATH=$PATH:/usr/local/go/bin:/root/go/bin
RUN go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.7.2 \
&& go install github.com/evilmartians/lefthook@latest \
&& go install gotest.tools/gotestsum@latest \
&& go install github.com/air-verse/air@latest \
&& go clean -cache -modcache
COPY --from=deps /root/deps/lychee/lychee /usr/local/bin/lychee
COPY --from=deps /opt/imgproxy/lib /opt/imgproxy/lib
COPY --from=deps /opt/imgproxy/include /opt/imgproxy/include
COPY --from=deps /opt/imgproxy/bin /opt/imgproxy/bin
COPY --from=deps /root/.bashrc /root/.bashrc
ENV BASH_ENV=/root/.bashrc
ENV IMGPROXY_IN_BASE_CONTAINER=true
WORKDIR /app
CMD ["bash"]