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

Improved Docker image build / sandbox setup process #99

Merged
merged 1 commit into from
Apr 1, 2024

Conversation

KyeRussell
Copy link
Contributor

I've been playing with Packj in a way that has necessitated a lot of Docker rebuilds. I eventually opted to try to speed the build process up a bit. These are the associated changes, if you are interested in taking them on.

  • Dockerfile changes:
    • Changed step ordering to decrease number of step rebuilds required when common things (e.g. the codebase) change.
    • Replaced usage of the apt command-line too with apt-get. apt has an unstable interface and its authors recommend against using it in an automated fashion.
    • Use Docker BuildKit caching for OS-level (apt), Python, and Ruby dependency installation steps.
    • Optimised Node.js installation process such that Node.js can be installed alongside the rest of the OS-level dependencies.
    • Only go through expensive / time-consuming sandbox setup process if the sandbox-related files have actually changed. If the codebase changes without the sandbox files changing, the previous sandbox setup persists.
  • Sandbox setup (setup.sh) changes:
    • Added set -uo pipefail and IFS=$'\n\t' ('Unofficial bash strict mode') per bash practice for bash scripts. Note that set -e (usually part of strict mode) was not easily doable here (without changing how the script works). To minimise changes, I just excluded it, but it'd be nice to be able to use it at some point in the future.
    • Passing in the -v flag will print output that was previously just written to a log file. I added this to make the Docker image creation process more verbose, per best practice as you typically won't get access to log files written during the image build process.
    • Fixed typo ("Clonning" -> "Cloning").
    • Fixed some cases where the script would incorrectly return a zero exit status, which would incorrectly imply to Docker that the script had exited successfully, when it had in fact failed.

Copy link
Collaborator

@ashishbijlani ashishbijlani left a comment

Choose a reason for hiding this comment

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

Look good.

@ashishbijlani ashishbijlani merged commit 45da694 into ossillate-inc:main Apr 1, 2024
1 check failed
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