Skip to content

Conversation

saberistic
Copy link

@saberistic saberistic commented Sep 5, 2024

This PR allows using enclavectl to build the tlsn notary docker image appropriate for EKS deployment

Copy link

@PratyushRT PratyushRT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks solid, wanted to discuss the following briefly before we merge @saberistic:

  • For Dockerfile, would it possibly be better to make the build more multi-stage to reduce the final image size
  • Should we be using a specfic version of gvproxy to ensure that your build is reproducible and less likely to break due to unexpected changes in dependencies
  • For run.sh should we add a bit more error handling and logging to make troubleshooting easier
  • Iirc using sleep infinity keeps the container running but doesn't provide any way to gracefully shut down or respond to signals: what if we use a while loop instead of sleep infinity

@PratyushRT
Copy link

Here's what I was thinking in terms of multi-stage builds:
Each FROM statement can use a different base, and begins a new stage of the build. This can selectively copy artifacts from one stage to another, leaving behind everything we don't want in the final image. Would this cause any issues?

# Build stage
FROM amazonlinux:2 as builder
RUN amazon-linux-extras install aws-nitro-enclaves-cli -y
RUN yum update -y && \
    yum install -y \
    aws-nitro-enclaves-cli-dev \
    jq \
    wget \
    procps
RUN wget https://github.com/containers/gvisor-tap-vsock/releases/download/v0.7.5/gvproxy-linux-amd64
RUN mv gvproxy-linux-amd64 gvproxy
RUN chmod +x gvproxy

# Final stage
FROM amazonlinux:2
COPY --from=builder /usr/bin/nitro-cli /usr/bin/nitro-cli
COPY --from=builder /usr/lib64/libnitro_enclaves.so* /usr/lib64/
COPY --from=builder /gvproxy /usr/bin/gvproxy
COPY bin/notary-server.eif /home
COPY notary/run.sh  /home
CMD ["/home/run.sh"]

@saberistic
Copy link
Author

Thanks for awesome review

  • Yes to multistage and reducing image size
  • gvproxy doesnt run in enclave environment so it doesn't need to be reproducible however fixing version makes total sense
  • run.sh should be refactored with a while loop that checks the heart beat of enclave sleeps and continues

@saberistic saberistic self-assigned this Sep 19, 2024
@saberistic
Copy link
Author

this PR is also related to https://github.com/EternisAI/tlsn/pull/7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants