Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

add filelessexec script, build binaries at build-time #1873

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 26 additions & 8 deletions examples/multiubuntu/build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,36 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright 2021 Authors of KubeArmor

FROM ubuntu:18.04
FROM ubuntu:22.04 as builder

RUN apt-get update && apt install -y gcc python3 pipx python3-venv
COPY helloworld/ /helloworld/
COPY readwrite/ /readwrite/

RUN gcc -o hello /helloworld/hello.c
RUN gcc -o readwriter /readwrite/readwrite.c

RUN pipx install fee

ENV PATH=$PATH:/root/.local/bin

RUN fee /bin/ls > /ls.py


FROM ubuntu:22.04

RUN apt-get update

RUN apt-get install -y net-tools iputils-ping telnet ssh tcpdump nmap dsniff arping
RUN apt-get install -y curl iperf3 netperf ethtool python-scapy python-pip
RUN apt-get install -y curl iperf3 netperf ethtool python3 python3-scapy python3-flask pipx python3-venv
RUN apt-get install -y iptables bridge-utils apache2 vim

RUN apt-get clean
RUN apt-get autoremove -y
RUN rm -rf /var/lib/{apt,dpkg,cache,log}/

RUN pip install flask

RUN ln -s $(which python3) /usr/bin/python
ADD flask/http_test.py /
COPY entrypoint.sh /entrypoint.sh

Expand All @@ -30,7 +47,7 @@ RUN echo "key file" >> /credentials/keys/priv.key

RUN useradd --create-home --shell /bin/bash user1
RUN echo 'user1:passwd1' | chpasswd
COPY hello /home/user1/hello
COPY --from=builder /hello /home/user1/hello
RUN chown user1:user1 /home/user1/hello

RUN echo "secret file user1" >> /home/user1/secret_data1.txt
Expand All @@ -44,8 +61,9 @@ RUN chown user1:user1 /home/user1/dir1/key1.txt
RUN echo "other file" >> /home/user1/otherfile.txt
RUN chown user1:user1 /home/user1/otherfile.txt

COPY readwriter /readwrite
COPY readwriter /home/user1/readwrite
RUN chown user1:user1 /home/user1/readwrite
COPY --from=builder /readwriter /home/user1/readwrite
RUN chown user1:user1 /home/user1/readwrite

COPY --from=builder /ls.py /ls.py

CMD [ "/entrypoint.sh" ]
CMD [ "/entrypoint.sh" ]
Binary file removed examples/multiubuntu/build/hello
Binary file not shown.
Binary file removed examples/multiubuntu/build/readwriter
Binary file not shown.