Skip to content

Commit

Permalink
Made eks image smaller
Browse files Browse the repository at this point in the history
  • Loading branch information
cody-constine-ttd committed Jul 23, 2024
1 parent e4007e0 commit 6f362a3
Showing 1 changed file with 36 additions and 4 deletions.
40 changes: 36 additions & 4 deletions scripts/aws/eks/pod/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,40 @@
FROM amazonlinux:2023
######## full image ########
FROM amazonlinux:2023 as full_image

RUN yum install -y aws-nitro-enclaves-cli && \
yum install aws-nitro-enclaves-cli-devel jq -y

WORKDIR /ne-deps

# Copy only the required binaries to /ne-deps folder.
#
RUN BINS="\
/usr/bin/nitro-cli \
/usr/bin/nitro-enclaves-allocator \
/usr/bin/jq \
" && \
for bin in $BINS; do \
{ echo "$bin"; ldd "$bin" | grep -Eo "/.*lib.*/[^ ]+"; } | \
while read path; do \
mkdir -p ".$(dirname $path)"; \
cp -fL "$path" ".$path"; \
done \
done

# Prepare other required files and folders for the final image.
#
RUN \
mkdir -p /ne-deps/etc/nitro_enclaves && \
mkdir -p /ne-deps/run/nitro_enclaves && \
mkdir -p /ne-deps/var/log/nitro_enclaves && \
cp -rf /usr/share/nitro_enclaves/ /ne-deps/usr/share/ && \
cp -f /etc/nitro_enclaves/allocator.yaml /ne-deps/etc/nitro_enclaves/allocator.yaml

######## smaller image ########
FROM amazonlinux:2023 as image

COPY --from=full_image /ne-deps /

RUN dnf install aws-nitro-enclaves-cli -y
# RUN yum install -y libxcrypt-compat
RUN dnf -y install iproute
RUN dnf -y install net-tools

Expand All @@ -18,7 +51,6 @@ COPY ./uid2operator.eif /home/
COPY ./proxies.host.yaml /home/proxies.host.yaml

RUN chmod +x /home/vsockpx && chmod +x /home/entrypoint.sh
# RUN yum install net-tools -y

COPY ./app.py /home/config-server/
COPY ./requirements.txt /home/config-server/
Expand Down

0 comments on commit 6f362a3

Please sign in to comment.