Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Decrease Docker image size, fixes #33 #37

Merged
merged 3 commits into from
Jul 26, 2023
Merged

Conversation

lgingerich
Copy link
Contributor

Motivation

Reduce the Docker size as referenced in Issue #33

Solution

  1. Use Python 3.11.3-slim rather than Python 3.11.3
  2. Implement a multi-stage build process to reduce number of unused files/layers in final image

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

Metrics

  • Original image = 1.8GB
  • Original image with slim Python image = 971 MB
  • Multi-stage & slim Python image (this PR) = 726 MB

There also seems to be a decrease in build time with this update although I didn't properly benchmark that.

Dockerfile Outdated
Comment on lines 25 to 30
ENV PATH="${PATH}:/home/${USERNAME}/.local/bin"
RUN adduser $USERNAME
USER $USERNAME

# install vegeta
RUN mkdir -p /home/$USERNAME/bin/vegeta_files
WORKDIR /home/$USERNAME/bin/vegeta_files
RUN wget https://github.com/tsenart/vegeta/releases/download/v12.8.4/vegeta_12.8.4_linux_amd64.tar.gz
RUN tar xzf vegeta_12.8.4_linux_amd64.tar.gz
RUN ln -s /home/$USERNAME/bin/vegeta_files/vegeta /home/$USERNAME/bin/vegeta
COPY --from=flood-builder /home/$USERNAME/.local /home/$USERNAME/.local
COPY --from=vegeta-builder /vegeta/vegeta /home/$USERNAME/bin/vegeta
Copy link
Contributor

Choose a reason for hiding this comment

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

Vegeta needs to either be moved to ~/.local/bin or you need to add ~/bin/ to the PATH

@sslivkoff sslivkoff merged commit 67d3695 into paradigmxyz:main Jul 26, 2023
3 checks passed
@sslivkoff
Copy link
Member

thanks for the PR @lgingerich. want to make the docker image as useful as possible

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.

None yet

3 participants