Skip to content

Commit

Permalink
add filelessexec script, build binaries at build-time
Browse files Browse the repository at this point in the history
Signed-off-by: rksharma95 <ramakant@accuknox.com>
  • Loading branch information
rksharma95 committed Oct 14, 2024
1 parent 6358229 commit 2e0aaba
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 7 deletions.
31 changes: 24 additions & 7 deletions examples/multiubuntu/build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,34 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright 2021 Authors of KubeArmor

FROM ubuntu:18.04
FROM ubuntu:20.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:20.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
ADD flask/http_test.py /
COPY entrypoint.sh /entrypoint.sh

Expand All @@ -30,7 +45,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 @@ -45,7 +60,9 @@ 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.

0 comments on commit 2e0aaba

Please # to comment.