Skip to content

Commit

Permalink
Docker fixes (#212)
Browse files Browse the repository at this point in the history
* docker: remove obsolete compose header

* docker: don't shadow staticfiles

A classic case of:

1. a Docker container gets its own filesystem ;
2. it runs a process that creates a thing (here: the "staticfiles"
directory) ;
3. we mount our local directory over /app (to get live changes) ;
4. that shadows the only-in-Docker-FS "staticfiles".

See [1] for a similar case.

[1]: betagouv/rails-template@1f69642

* docker: remove the docker-compose dash

* make: misc fixes

* index: use the exec wrapper ;
* init: don't try to reinstall things, focus on the actual init.

* docker: upgrade POETRY_VERSION

* docker: ignore staticfiles
  • Loading branch information
freesteph authored Oct 3, 2024
1 parent 7721135 commit 0bd3988
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.git
.github
.mypy_cache
staticfiles
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ENV GECKODRIVER_URL=https://github.com/mozilla/geckodriver/releases/download/v0.
ENV APP_DIR="/app"

# Configure Poetry
ENV POETRY_VERSION=1.7.0
ENV POETRY_VERSION=1.8.2
ENV POETRY_HOME=/opt/poetry
ENV POETRY_VENV=/opt/poetry-venv
ENV POETRY_CACHE_DIR=/opt/.cache
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ifneq (,$(wildcard ./.env))
endif

ifeq ($(USE_DOCKER),1)
EXEC_CMD := docker-compose exec -ti web
EXEC_CMD := docker compose exec -ti web
else
EXEC_CMD :=
endif
Expand Down Expand Up @@ -44,7 +44,7 @@ fix:

.PHONY: index
index:
poetry run python manage.py update_index
$(EXEC_CMD) poetry run python manage.py update_index

.PHONY: init
init:
Expand Down
3 changes: 1 addition & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3.7'

services:
db:
image: postgres:14.5-alpine
Expand All @@ -23,6 +21,7 @@ services:
- "${HOST_PORT}:${HOST_PORT}"
volumes:
- .:/app
- "/app/staticfiles"
depends_on:
- db

Expand Down

0 comments on commit 0bd3988

Please sign in to comment.