-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
56 lines (51 loc) · 1.73 KB
/
Dockerfile
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
FROM python:alpine
ENV SHELL=/bin/sh \
LANG=C.UTF-8 \
PYTHONUNBUFFERED=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PIP_NO_CACHE_DIR=0 \
CC=/usr/bin/clang \
CXX=/usr/bin/clang++
COPY requirements.txt /srv
WORKDIR /srv
RUN \
# Create user
addgroup -g 423 -S kernelcollector \
&& adduser -u 423 -S kernelcollector -G kernelcollector \
# Upgrade system
&& apk update \
&& apk add --no-cache --virtual .dev-deps g++ clang autoconf gettext-tiny libtool automake make bzip2-dev libmd-dev linux-headers perl zlib-dev zstd-dev file patch grep \
&& apk add --no-cache gnupg gzip fakeroot xz tar zlib bzip2 zstd-libs libmd curl \
# Compile dpkg from source (needed for zstd support)
&& cd /tmp \
# Find latest version of dpkg
&& DPKG_URL="http://archive.ubuntu.com/ubuntu/pool/main/d/dpkg" \
&& DPKG_VERSION=$(curl -Ls "$DPKG_URL/?C=M;O=D" | grep -Poh -m 1 "(?<=\")dpkg_.+\.tar\.xz(?=\")") \
&& curl -Ls "$DPKG_URL/$DPKG_VERSION" | tar -xJ \
&& cd dpkg* \
&& if [[ -f configure ]]; then rm configure; fi \
&& ./autogen \
&& chmod +x configure \
&& ./configure --prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/tmp \
--with-libz \
--with-libbz2 \
--with-libzstd \
--disable-dselect \
--disable-start-stop-daemon \
--disable-nls \
--disable-static \
--disable-devel-docs \
&& make -j$(nproc) \
&& make install \
&& cd /srv \
# Install Python dependencies
&& pip install --no-cache --upgrade -r requirements.txt \
&& chown -R kernelcollector:kernelcollector . \
# Cleanup
&& apk del .dev-deps \
&& rm -rf /tmp/* /var/cache/apk/*
COPY . /srv
USER kernelcollector
ENTRYPOINT ["/bin/sh", "/srv/entrypoint.sh"]