forked from aquasecurity/tracee
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.alpine-tracee-make
50 lines (41 loc) · 1.91 KB
/
Dockerfile.alpine-tracee-make
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
################################################################################
# INSTRUCTIONS
################################################################################
#
# This Dockerfile is meant to create a building/exec environment for tracee.
#
################################################################################
FROM alpine:3.16
ARG uid=1000
ARG gid=1000
# install needed environment
RUN apk --no-cache update && \
apk --no-cache add sudo coreutils findutils && \
apk --no-cache add bash git curl rsync && \
apk --no-cache add musl-dev libc6-compat && \
apk --no-cache add llvm clang go make gcc && \
apk --no-cache add linux-headers && \
apk --no-cache add elfutils-dev && \
apk --no-cache add libelf-static && \
apk --no-cache add zlib-static && \
curl -L -o /usr/bin/opa https://github.com/open-policy-agent/opa/releases/download/v0.44.0/opa_linux_amd64_static && \
chmod 755 /usr/bin/opa
# allow TRACEE* and LIBBPFGO* environment variables through sudo
RUN echo "Defaults env_keep += \"LANG LC_* HOME EDITOR PAGER GIT_PAGER MAN_PAGER\"" > /etc/sudoers && \
echo "Defaults env_keep += \"LIBBPFGO* TRACEE*\"" >> /etc/sudoers && \
echo "root ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \
echo "tracee ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \
chmod 0440 /etc/sudoers
# prepare tracee user to be $UID:$GID host equivalent
RUN export uid=$uid gid=$gid && \
mkdir -p /home/tracee && \
echo "tracee:x:${uid}:${gid}:Tracee,,,:/home/tracee:/bin/bash" >> /etc/passwd && \
echo "tracee:x:${gid}:" >> /etc/group && \
echo "tracee::99999:0:99999:7:::" >> /etc/shadow && \
chown ${uid}:${gid} -R /home/tracee && \
echo "export PS1=\"\u@\h[\w]$ \"" > /home/tracee/.bashrc && \
echo "alias ls=\"ls --color\"" >> /home/tracee/.bashrc && \
ln -s /home/tracee/.bashrc /home/tracee/.profile
USER tracee
ENV HOME /home/tracee
WORKDIR /tracee