-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Renames docker-compose.yml => compose.yaml which is the new preferred name going forward Moves Dockerfiles to subdirectory, ensuring the filenames end with Dockerfile (for syntax highlighting in IDEs) Renamed the `web` service to `app`, since this is typical for Docker examples and is also what bakerydemo uses Various tricks and tips to optimize the build cache to speed up subsequent builds The new Dockerfile was partially based on the output of `docker init`, which includes some best practices: * create non-root users to run the applications * use bind-mounts for pip & npm installs (this means that when adding a new requirement, it will only download the new package and install everything else from the cache) NOTE: the wagtail and libs directories are no longer COPY'd into the container for doing a `pip install`, but installing wagtail and django-modelcluster creates .egg-info directories, so the bind mounts need write access. Added custom ignore files for each Dockerfile to restrict the build context to the absolute minimum Added a custom requirements file to avoid relying on bakerydemo's requirements which results in duplicate installs. The previous setup was installing bakerydemo requirements, which installed wagtail, django-modelcluster, and Willow, and then a few steps later, reinstalling these packages from the local sources. Now they are only installed once. The CMDs for both `app` and `frontend` are now wrapped with `dumb-init` (node is not designed to run as PID 1) which handles killing the processes. Previously attempting the Ctrl-C the running containers would hang waiting for `npm` to give up the ghost, now it exits immediately.
- Loading branch information
Showing
16 changed files
with
189 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
services: | ||
web: | ||
volumes: | ||
- ./.vscode:/code/.vscode:delegated,rw | ||
- ./.vscode:/code/.vscode | ||
|
||
# Overrides default command so things don't shut down after the process ends. | ||
command: /bin/sh -c "while sleep 1000; do :; done" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
volumes: | ||
postgres-data: | ||
node_modules: | ||
|
||
services: | ||
app: | ||
build: | ||
context: . | ||
dockerfile: docker/app.Dockerfile | ||
volumes: | ||
- ./wagtail:/code/wagtail | ||
- ./libs:/code/libs | ||
- ./bakerydemo:/code/bakerydemo | ||
ports: | ||
- "8000:8000" | ||
depends_on: | ||
db: | ||
condition: service_healthy | ||
frontend: | ||
condition: service_started | ||
|
||
db: | ||
environment: | ||
- "POSTGRES_DB=${DATABASE_NAME}" | ||
- "POSTGRES_USER=${DATABASE_USER}" | ||
- "POSTGRES_PASSWORD=${DATABASE_PASSWORD}" | ||
restart: always | ||
image: postgres:16.0-bookworm | ||
volumes: | ||
- postgres-data:/var/lib/postgresql/data | ||
healthcheck: | ||
test: "pg_isready --quiet --dbname=${DATABASE_URL}" | ||
interval: 10s | ||
timeout: 5s | ||
retries: 5 | ||
|
||
frontend: | ||
build: | ||
context: . | ||
dockerfile: docker/frontend.Dockerfile | ||
volumes: | ||
- ./wagtail:/code/wagtail |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.