Prebuilt docker images with Github Actions - #199
Conversation
| mkdir gutenberg && cd gutenberg | ||
|
|
||
| # Download compose.yml | ||
| curl -O [https://raw.githubusercontent.com/KSIUJ/gutenberg/main/compose.yml](https://raw.githubusercontent.com/KSIUJ/gutenberg/main/compose.yml) |
There was a problem hiding this comment.
You cannot use annotated links inside code blocks in markdown.
| Docker reduce the disk space used by the images. | ||
|
|
||
| are used to select versions of the base images. The same versions should albo be used | ||
| when specifying image versions in `compose.yml`. Using common versions let's Docker reduce the disk space used by the images. |
There was a problem hiding this comment.
Oh, I made a typo here
| when specifying image versions in `compose.yml`. Using common versions let's Docker reduce the disk space used by the images. | |
| when specifying image versions in `compose.yml`. Using common versions lets Docker reduce the disk space used by the images. |
There was a problem hiding this comment.
Why does this PR remove the existing commits? Also the new commits clearly indicate the changes requested from an AI agent and are not actually useful for admins.
| file: ./secrets/postgres_password.txt | ||
| gutenberg_django_secret_key: | ||
| file: ./secrets/django_secret_key.txt | ||
| file: ./secrets/django_secret_key.txt No newline at end of file |
There was a problem hiding this comment.
Revert the removal of the trailing new line here
| file: ./secrets/django_secret_key.txt | |
| file: ./secrets/django_secret_key.txt | |
There was a problem hiding this comment.
I would suggest also keeping a development version of the compose.yml file which builds the images from the repo instead of using published images.
| ```bash | ||
| cp backend/gutenberg/settings/docker_settings.py.example backend/gutenberg/settings/docker_settings.py | ||
| ``` | ||
| In `docker_settings.py`, fill in the following fields properly: | ||
| * `ALLOWED_HOSTS` - list of hosts that can connect to the app | ||
| * `CSRF_TRUSTED_ORIGINS` - list of trusted origins for CSRF protection | ||
|
|
||
| In addition, the value of `SECRET_KEY` will by default be read from the Docker secret | ||
| `gutenberg_django_secret_key`. It should be set to a unique random string. | ||
| An example of how to generate one can be found below in the [docker-compose.yml](#docker-composeyml) section. | ||
|
|
||
| For example: | ||
| ```python | ||
| ALLOWED_HOSTS = ['127.0.0.1', 'localhost'] | ||
| CSRF_TRUSTED_ORIGINS = [ | ||
| 'http://127.0.0.1:3000', | ||
| 'http://localhost:3000', | ||
| ] |
There was a problem hiding this comment.
Why remove this section? It is still applicable, only the path of the settings file might be different.
| dockerfile: Dockerfile | ||
| target: run_backend | ||
| # Use published image instead of building from source | ||
| image: ghcr.io/ksiuj/gutenberg-backend:main |
There was a problem hiding this comment.
Are you sure ksiuj will be lowercase here? The name of our GitHub org is KSIUJ (all caps)
There was a problem hiding this comment.
The comments call the repo ksiuj/gutenberg, but the org name is uppercase (KSIUJ not ksiuj). See:
https://github.com/KSIUJ/gutenberg/pull/199/changes#r3786809342
There was a problem hiding this comment.
Please describe the automatic publishing of images here. Especially:
- when are the images built?
- how are the images labelled, and tagged (versioned)?
- do we have a
latestorstabletag?
| dockerfile: Dockerfile | ||
| target: run_backend | ||
| # Use published image instead of building from source | ||
| image: ghcr.io/ksiuj/gutenberg-backend:main |
There was a problem hiding this comment.
Suggesting the use of the main tag is not a great idea. When we release breaking changes, a config referencing main might break.
It's also imperative that users use the same version of all images.
I suggest using an env variable like GUTENBERG_VERSION to solve both of these problems. This way we don't need to update the tags in the example compose.yml each time a new version of Gutenberg is released, while the version tag is configured for all containers at once.
#184
This pull request implements the requested CI/CD pipeline for Docker images and simplifies the setup process for end-users.
Changes:
docker-publish.yml) to automatically build and publishbackend,celery, andproxyimages to the GitHub Container Registrydocker-compose.ymland introduced a newcompose.ymlthat pulls the prebuilt images from GHCR instead of building them from sourcedocker_settings.pynext to thecompose.ymlfile. Updated theImportErrormessage indocker_server_overrides.pyto reflect thisdocs/docker.mdand internal docs. Added instructions for users to fetch the required setup files (compose.ymlanddocker_settings.py.example) directly from the repository usingcurl