Add Dockerfile
Add Dockerfile to easily build the project as Docker image.
(I will do this and create a PR.)
Hi @jlelse, have you made any progress on this? I already use a Dockerfile locally and am happy to let the community iterate on it. 😊
@hirusi Oh I'm sorry, in the end I didn't choose Indiekit but wrote my own micropub endpoint. So I also have no Dockerfile for Indiekit.
For v0.0.x, a reference Dockerfile is available here. Let me be upfront in stating this is not supposed to be production-ready; works for me, your mileage may vary.
Once v0.1.0 is published, I will be happy to contribute a starting point for a Dockerfile.
Just saw the notification for the v0.1 release and wanted to drop by for a quick update: I have moved over to WP and at least as of now have no motivation to work on this.
To anyone else who wants to pick this up, please feel free to if you'd like, fellow interneter.
For anyone needing a sample Docker setup, I've got one in my site's Indiekit repo. Hit me up if you need any help getting it to work (or integrating this into the official project).
@paulrobertlloyd I think my Docker setup is pretty solid. It uses Docker Compose to create a MongoDB server alongside the Indiekit Node server and connects the two up, configuring them with an .env file, a sample of which is provided in the repo.
I could imagine some users would prefer to use third party managed MongoDB hosting and just run the Indiekit server themselves, so I could still make the Indiekit Dockerfile a little more flexible by declaring the environment variables necessary for this (especially MONGO_URL), to prompt the user to provide them.
I'm thinking that npm create indiekit should generate a Dockerfile for the indiekit server itself (which can be provided a MONGO_URL, etc.), and a docker-compose.yml for running Indiekit and a MongoDB server. The documentation should explain how to configure and run both of these setups.
@sentience Glad you got it working. If you wanted to submit a PR to the example config repo, I think that might be a good first step in making a baseline Docker config more widely available.
@thejdev did something similar earlier this year, but that was when the project was using an older configuration file format. Maybe there are some aspects of Jaidev’s PR that could be used?
I'm thinking that
npm create indiekitshould generate a Dockerfile for the indiekit server itself (which can be provided aMONGO_URL, etc.), and adocker-compose.ymlfor running Indiekit and a MongoDB server. The documentation should explain how to configure and run both of these setups.
This is an excellent idea! This would be the perfect way to generate the required Docker config files, and I’d like to include this in the final release of v1.0.0. Happy to do this, but if you’d like to submit a PR for that too, I’d be happy to point you in the right direction.
The example config now provides an example Dockerfile and related docker-compose.yml and .dockerignore files.
This means there is at least now some ‘official’ recommendation (though one that I’m happy to update based on feedback). However, given some of the environment values and other factors will vary based on an individual’s Indiekit config, I’m going to keep this issue open until I’ve added the option to create these files as part of the initialisation script.
Hopefully having such functionality will make onboarding with Docker easier, and make writing the tutorials for getting started with different hosting providers a bit easier too!
With the addition of #639, there is now fuller support for Docker.
When it comes to writing tutorials for different hosting platforms, the documentation can recommend using the option to create the various Docker files as part of the initial configuration and setup step. It can also note which is these files is used by those different services (Railway doesn’t yet support Docker Compose, for example).
Thanks again for the suggestion, @sentience.