Skip to content

Commit

Permalink
CC-2137 NZSL move Signbank to poetry (#171)
Browse files Browse the repository at this point in the history
##JIRA Ticket

[CC-2137 NZSL: move signbank to
Poetry](https://ackama.atlassian.net/browse/CC-2137)

## Changes

- `requirements.*` files removed
- `pyproject.toml` and `poetry.lock` added
- unpinned all dependencies
- added `depends_on` and `healthcheck` to `docker-compose.yml` to avoid
database race condition on local dev
- exposed port `5432` on local dev
- `0.0.0.0` added to `DEFAULT_ALLOWED_HOSTS`
  • Loading branch information
jonholdsworth authored Jun 21, 2024
1 parent a27d457 commit 522f959
Show file tree
Hide file tree
Showing 6 changed files with 685 additions and 27 deletions.
13 changes: 8 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ FROM python:3.9

ENV DJANGO_SETTINGS_MODULE=signbank.settings.development

CMD pip install -r requirements.txt && \
bin/develop.py migrate --noinput && \
RUN pip install "poetry==1.8.3"

CMD bin/develop.py migrate --noinput && \
bin/develop.py createcachetable && \
(\
(test $DJANGO_SETTINGS_MODULE = 'signbank.settings.development' && \
Expand Down Expand Up @@ -44,8 +45,10 @@ RUN echo "APT::Install-Recommends \"0\";" >> /etc/apt/apt.conf.d/02recommends &&

# Install requirements
WORKDIR /app
ADD requirements.txt /app
RUN pip --no-cache-dir install --src=/opt pyinotify -r requirements.txt
ADD pyproject.toml poetry.lock /app/
RUN poetry config installer.max-workers 10 && \
poetry config virtualenvs.create false && \
poetry install -v --no-root

# Copy frontend assets
COPY --from=node /app/signbank/static/js ./signbank/static/js
Expand All @@ -55,4 +58,4 @@ COPY --from=node /app/signbank/static/css ./signbank/static/css
ADD . /app

# Collect static assets
RUN bin/develop.py collectstatic
RUN bin/develop.py collectstatic --no-input
10 changes: 10 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,20 @@ services:
links:
- database
- mail
depends_on:
database:
condition: service_healthy
database:
image: postgres:14
environment:
- "POSTGRES_PASSWORD=postgres"
ports:
- 5432:5432
healthcheck:
test: ["CMD", "/usr/bin/pg_isready", "-h", "database", "-p", "5432", "-U", "postgres", "-d", "postgres"]
interval: 3s
timeout: 2s
retries: 5
mail:
image: djfarrelly/maildev
ports:
Expand Down
Loading

0 comments on commit 522f959

Please sign in to comment.