-
Notifications
You must be signed in to change notification settings - Fork 70
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
Refactor Dockerfile and add some dependencies #44
base: 7.1-stretch
Are you sure you want to change the base?
Refactor Dockerfile and add some dependencies #44
Conversation
084e1bf
to
8994b2e
Compare
This is now looking good for 71. |
Hi Andrew, At the end, the only downside of this change IMHO is an increase of the size due to HTH, |
Unless I'm wrong there are also some CIs needing to perform git operations. Namely:
Those are the 2 main reasons I can imagine (specially the 2nd one), requiring to have git at hand. Ciao :-) |
ddfa1a0
to
5805ad0
Compare
5805ad0
to
29c8425
Compare
Hi Matteo, At this point it's specifically for some of our CI jobs. I'm trying to remove git from some of those jobs, but some of them will continue to require it. For example, some of the CI jobs use git to determine which files have changed between commits. One such job is the php-lint job. |
I've updated the branch to fix up those minor issues pointed out by Matteo. I've also added an
I've also made changes to ensure that it can be run properly by the www-data user (or any other user). Note: Only a privileged user can |
Hi @andrewnicols and @stronk7,
What I'm reading behind your lines is that your CI Hosts should be as simple as possible i.e OS + docker engine i.e. CI jobs requirements should be satisfied by the image running/being the target of the job. I'm far from having a clear picture of all the jobs in Moodle CI but wondering if some of the jobs should be performed using a different image e.g. the merge checks should be performed by a job invoking an image providing git - I'm used to play with bash functions e.g. https://hub.docker.com/r/alpine/git/#optional-usage-1, which is nice for any required command but providing someway git in the CI Host so if the goal is to keep the CI Host surface as small as possible for security reasons maybe it's not nice as I'm assuming w/ my arguments. At the end mine looks like a speculation when coming on discussing how running the db comparator checker.
I suggest to proceed on the or any other user in a different issue since it requires IMHO some more changes and I'm not sure if the upstream image is ready too unless playing some magic with the users map in the image.
Shortly, any change on file permissions should use Edit: upstream image way of supporting an arbitrary user, https://hub.docker.com/_/php/#running-as-an-arbitrary-user => https://github.com/docker-library/php/blob/640a30e8ff27b1ad7523a212522472fda84d56ff/7.1/stretch/apache/Dockerfile#L42 and https://github.com/docker-library/php/blob/640a30e8ff27b1ad7523a212522472fda84d56ff/7.1/stretch/apache/Dockerfile#L60. I'll post my thoughts in #1 after this PR will land - shortly, at least HTH, |
Correct. Our CI infrastructure is based around Jenkins and makes use of dumb, disposable, nodes which essentially have docker-engine, Java, and a Jenkins client installed. There are a few other tools installed to orchestrate some of the jobs.
I've been testing some of my changes at https://ci.moodle.org/view/Testing/job/DEV.98%20-%20Testing%20standard%20jobs/ recently. I'm looking at exactly this use-case, but some of our jobs really do need PHP + Git, and some of our jobs really do need PHP + Grunt + Git. Ultimately the
I don't think we plan to go down this route at the moment. It's something I was considering, but ultimately it adds too much complexity for 99% of use-cases.
It is intended to be suitable for that, yes.
We call the existing Apache entrypoint and cmd, so we should support them in the same way the PHP does. |
Just to give my (looking from afar) two cents - I like the idea of this being acheived by a fat and thin image variant rather than enforcing the fat image on every non-moodle-ci user. |
That was my original thought, but what do you include in each? Does the thin variant need OCI + MSSQL given so few people actually use it?
Do we ever need a CI version with mssql + ocI? |
Just to note that I've started work on a complete rewrite branch: andrewnicols@complete_rewrite This uses an update.sh in the same fashion as the php library, and moves all content to the Dockerfile (as per the clarity guidelines). This generates images in the format: There are version for 7.1, 7.2, 7.3 of PHP and currently it supports the My thinking is to then create a new official-images repo in the same vein as http://github.com/docker-library/official-images/ with an entry for the php image similar to https://github.com/docker-library/official-images/tree/master/library We will alias the This will give us a total of 6 unique images per PHP version, but with 5 of those being smaller layers on top of the others. We'll have tags galore too. |
Hi @andrewnicols, I like your new proposal, even if it impacts on https://github.com/moodlehq/moodle-docker too.
HTH, |
I’m about to head out so can’t answer it full, but I feel that the images should just be the db desires and not all.
Oracle adds close to 200mb to the image from memory and few people use it.
When it comes to the Docker scripts you specify a single dB.
Most devs are testing with a single dB at a time. If they need to test something quirky they often test just that one.
|
Yep, if DEV uses a fully containerized setup then she/he is running a "compose" of it i.e. fixing the DB server type too. Matteo |
I had intended to include Node in the base image. Node is a dev tool, whilst we expect to only use git in our CI infrastructure.
What is Generally speaking we only support one version of Node for each Moodle version. Most people are running a single version per Docker container so I'm not sure that we really need to use a prefix. Could you perhaps explain a bit more? |
Mmhh... are you confident that a DEV will actually use
A way to define where packages will be globally installed: https://github.com/nodejs/docker-node/blob/master/docs/BestPractices.md#global-npm-dependencies. If you have a fixed folder, you could export it outside the cointainer, on the host, and sharing it to the next running instance of the image at a next run. HTH, |
Hi, so, build changes aside (move from current branches to a directory based structure seems the way to go)... I'm more interested into the final hierarchy of the images, more exactly:
Maybe the problem with all this is that combinations are endless, heh. And many of them are equally "correct/appropriate". But really, if we want to advance with all this... we should make a decision and then, simply, go for it. Following a previous comment there... how would be:
Just making a choice and proposing it, I'm not specially strong on it. Of course note that all this will lead to a huge proliferation of images per PHP version: debian releases (1-2) * db (5) * variant (3) = up to 30 images! And of course moodle-docker will need a reorganization to be able to trigget the corresponding ones (that shouldn't be hard). As said, just aiming to get the organization planned, so it's clear for everybody before the internal changes happen. Thoughts? |
I definitely agree that this should not be added to the default image. That image should only contain the minimal requirements for a working runtime. Instead a dev variant should be created. |
@septatrix, this is the developer image. It is not intended to be used in any kind of production environment and never has been |
Hi @andrewnicols (et all), I think that we can close this old PR now and continue advancing in recent issues and PRs... what do you think? (just performing a quick triaging of old stuff) Ciao :-) |
Hi @stronk7,
+1 I think there is here some valuable work that we could re-evaluate with a new issue, compared to the current upstream (ff023e2) and, potentially, the outcome from #169. HTH, |
This change is primarily about:
During my changes I discovered some issues relating to our Dockerfile, and some other limitations. Notably:
/root/
to/
but this was causing cache invalidation. Even a small change after this point required everything to be rebuilt.To solve these, I have:
docker-entrypoint-initdb.d
directory and written a new entrypoint file (moodle-php-entrypoint
) which makes use of it. This is an extremely common way of achieving this, and uses the defacto standard nomenclature. The example is largely based on that used in Postgres.lts/carbon
(which is pre-installed). On initial startup of the image, NVM will install and use whichever version is specified via itsNODE_VERSION
environment variable. This startup node usage occurs in the new entrypoint file.ADD /root/ /
command into separate ADD commands for each script.I was hoping to make these changes in separate pull requests, but it's ended up easier doing it this way.
As I say, I'm currently unable to complete building of this image because of a bug with the Microsoft Debian repo. I'd like to get some initial feedback on these changes though in the mean time.
This will also need branches for 54, 70, 72, and 73.