-
Notifications
You must be signed in to change notification settings - Fork 329
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
Recreate PR #2861: Dockerfile cleanup #2866
base: main
Are you sure you want to change the base?
Conversation
cuihtlauac
commented
Dec 12, 2024
- don't cache packages to lighten the image.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, what happened? a misclick? did I miss something deeper?
Misclick from my phone, in the train... |
RUN sudo apk -U upgrade --no-cache && sudo apk add --no-cache \ | ||
autoconf \ | ||
curl-dev \ | ||
gmp-dev \ | ||
inotify-tools \ | ||
libev-dev \ | ||
oniguruma-dev \ | ||
openssl-dev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is nicer to read here, but harder in the ocluster log.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nicer for humans, and nicer diffs.
https://docs.docker.com/build/building/best-practices/#sort-multi-line-arguments
There’s something I don’t get. Docker builds in cluster and GH action and fails locally on my machine:
Any clues? |
Dockerfile
Outdated
|
||
# Branch freeze was opam-repo HEAD at the time of commit | ||
RUN cd opam-repository && git pull origin c45f5bab71d3589f41f9603daca5acad14df0ab0 && opam update | ||
RUN cd ~/opam-repository && git fetch -q origin master && git reset --hard c45f5bab71d3589f41f9603daca5acad14df0ab0 && opam update |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RUN cd ~/opam-repository && git reset --hard c45f5bab71d3589f41f9603daca5acad14df0ab0 && opam update
That commit is from June 3. Fetching here will is too early. Between two changes of this commit, we want to build the same switch and produce the same docker layer (up to system dependency changes)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what you mean…
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want Docker to cache the opam switch.
Dockerfile
Outdated
RUN cd opam-repository && git checkout master && git pull origin master && opam update | ||
ENV OCAMLORG_REPO_PATH opam-repository | ||
ENV OCAMLORG_PKG_STATE_PATH package.state | ||
RUN cd ~/opam-repository && git checkout master && opam update |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RUN cd ~/opam-repository && git checkout master && git pull origin master && opam update
We pull here, because the opam-repo changes super frequently and we need to prefetch the ocamlorg cache with as fresh as possible data. See discussion in PR#2831
- don't cache packages to lighten the image.
Co-authored-by: Antonin Décimo <[email protected]>
Co-authored-by: Antonin Décimo <[email protected]>