Add Codespaces support
Resolves #3829
Description
This PR adds support for GitHub Codespaces. It includes a devcontainer configuration that will be used to create a Codespace for this repository. The configuration includes:
- Dockerfile: Installs
ruby:dev-3.2-busterimage. When the version of ruby used by this project changes, the Dockerfile should be updated. An attempt to install the correct version of ruby will be done, but it will take a while to download and compile the version. - devcontainer.json: Specifies the configuration for the Codespace. It includes the Dockerfile to use, the extensions to install, and the settings to use.
- docker-compose.yml: Specifies the services to run in the Codespace. It includes the
postgresservice. - post-create.sh: Script that runs after the Codespace is created. It optionally installs a new version of ruby, sets up the database, and prepares the environment.
Type of change
- New feature (non-breaking change which adds functionality)
- This change requires a documentation update
- Documentation update
This PR adds codespaces support. It is not an externally facing feature. The documentation changes are only for setting up the dev environment. I have included a change to the README to help with this.
How Has This Been Tested?
To test this out, create a new codespace for the project, wait for everything to load, and run bin/start. The project should start with no errors.
@dorner does this change make sense to you? Now if the .env already exists, the codespace version will not be copied over.
Looks good to me - @awwaiid can you review?
Ah -- also from testing you need to add config.hosts << ".app.github.dev" to config/environments/development.rb
Closing in favour of https://github.com/rubyforgood/human-essentials/pull/4353.