cypht-org / cypht

Cypht: Lightweight Open Source webmail aggregator [PHP, JS]
http://cypht.org
GNU Lesser General Public License v2.1
949 stars 146 forks source link

POC: Docker files in local directory #980

Closed jonocodes closed 1 month ago

jonocodes commented 2 months ago

This is a proof of concept how how to move and use docker into the main repo, as discussed here: https://github.com/cypht-org/cypht-docker/issues/31#issuecomment-2081175722

It does not fully work since I have not lined up the env vars, but you can get it started and see the home page by running:

docker compose up --build

then visit http://localhost/

I have mostly copied over files from here: https://github.com/cypht-org/cypht-docker/tree/master/image and I left in the commented out lines so you can see some of the changes I introduced.

docker-compose.yaml here gives several benefits:

  1. It provides a runtime spec for the inputs required to run the program.
  2. You can easily pull down the git repo and use it right away too see how cypht behaves in docker.
  3. We can set it up such that this is also usable for a developer - such that they can work on the project without having php (and other dependencies) installed locally on the machine.
  4. We can use docker-compose.yaml to build and distribute production images - likely triggered by a github action or something.
jonocodes commented 2 months ago

I also added a few TODO notes on other things that could use updates.

marclaporte commented 2 months ago

Thank you @jonocodes

Good Docker support will be super good for the health of the project!

jonocodes commented 2 months ago

Ok. Not sure the best way to proceed - in terms of review, acceptance, etc. But for now I will continue on this POC and turn it into a working version along with my other suggestions.

marclaporte commented 2 months ago

As the saying goes: "rough consensus and running code"

kroky commented 2 months ago

I just noticed a huge docker entrypoint file trying to keep a hm3.ini file up to date - master and Cypht 2.0 is no longer using ini files for config - keeping the config in .env (or other env variables in dockerfiles) is just fine.

jonocodes commented 2 months ago

Where is cypht 2.0? Is that the same as master at this point?

marclaporte commented 2 months ago

Where is cypht 2.0? Is that the same as master at this point?

Yes, it will be branched and released any day now: https://github.com/cypht-org/cypht/issues/879

marclaporte commented 2 months ago

Inspiration from other projects:

kroky commented 2 months ago

Where is cypht 2.0? Is that the same as master at this point?

2.0 has just been released. You can push your changes to master for upcoming releases (2.1+), backport/push to 2.0.x branch for 2.0+ releases and to 1.4.x for older cypht version.

wangxiaoerYah commented 2 months ago

And for consistency with the mainline, the env used inside docker should be copied directly from the project's env file, not pre-defined for it, and overridden later by environment variables or other means.

jonocodes commented 2 months ago

The dockerfile is already inside the project and should no longer be downloaded using the wget archive.

Agreed. Thats why I removed wget.

Also, you should keep a tight control over the files in the docker container, e.g. only copy the files that are relevant to the runtime.

I have mixed feelings on that, as I am trying to simplify and streamline the docker process. I may address this with a .dockerignore file, but will think more on it.

Also, the .hm3 configuration file entry has been deprecated and the dockerfile needs to be updated.

Yeah, I dont quite understand the .hm3 file yet, but will try to do away with it when I get to that part.

jonocodes commented 2 months ago

And for consistency with the mainline, the env used inside docker should be copied directly from the project's env file, not pre-defined for it, and overridden later by environment variables or other means.

Is that now what I did? I did not look too deeply at the env implementation, but that was my intention.

jonocodes commented 2 months ago

I'm upgrading this POC to a WIP. See here: https://github.com/cypht-org/cypht/pull/1001