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

Recreate PR #2861: Dockerfile cleanup #2866

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Recreate PR #2861: Dockerfile cleanup #2866

wants to merge 5 commits into from

Conversation

cuihtlauac
Copy link
Collaborator

  • don't cache packages to lighten the image.

Copy link
Contributor

@MisterDA MisterDA left a 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?

Dockerfile Outdated Show resolved Hide resolved
Dockerfile Outdated Show resolved Hide resolved
@cuihtlauac
Copy link
Collaborator Author

Sorry, what happened? a misclick? did I miss something deeper?

Misclick from my phone, in the train...

Comment on lines +4 to +11
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
Copy link
Collaborator Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

@cuihtlauac
Copy link
Collaborator Author

There’s something I don’t get. Docker builds in cluster and GH action and fails locally on my machine:

------
Dockerfile:20
--------------------
  18 |     # Install opam dependencies
  19 |     COPY --chown=opam ocamlorg.opam .
  20 | >>> RUN opam install . --deps-only
  21 |     
  22 |     # Build project
--------------------
ERROR: failed to solve: process "/bin/sh -c opam install . --deps-only" did not complete successfully: exit code: 40
make: *** [Makefile:70: docker] Error 1

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
Copy link
Collaborator Author

@cuihtlauac cuihtlauac Dec 13, 2024

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)

Copy link
Contributor

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…

Copy link
Collaborator Author

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
Copy link
Collaborator Author

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

MisterDA and others added 4 commits December 13, 2024 19:07
- don't cache packages to lighten the image.
Co-authored-by: Antonin Décimo <[email protected]>
Co-authored-by: Antonin Décimo <[email protected]>
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