-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathDockerfile
More file actions
147 lines (115 loc) · 4.15 KB
/
Dockerfile
File metadata and controls
147 lines (115 loc) · 4.15 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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# 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 \
gcc-12 \
g++-12 \
make \
libc6-dev \
xz-utils \
bzip2 \
pkg-config \
libssl-dev \
libcurl4-openssl-dev \
libstdc++-12-dev
RUN update-alternatives --install /usr/bin/cc cc /usr/bin/gcc-12 100 && \
update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++-12 100 && \
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 100 && \
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 100
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 \
nasm \
libtool \
python3-pip \
python3-venv \
gettext \
gperf \
&& ./install-rust.sh \
&& python3 -m venv /root/.python \
&& /root/.python/bin/pip install meson ninja packaging cmake
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 \
gcc-12 \
g++-12 \
make \
xz-utils \
bzip2 \
libc6-dev \
pkg-config \
libssl-dev \
libstdc++-12-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/*
RUN update-alternatives --install /usr/bin/cc cc /usr/bin/gcc-12 100 && \
update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++-12 100 && \
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 100 && \
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 100
# 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.11.1 \
&& 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"]