File tree Expand file tree Collapse file tree 8 files changed +90
-23
lines changed
Expand file tree Collapse file tree 8 files changed +90
-23
lines changed Original file line number Diff line number Diff line change 5656 uses : actions/checkout@v4
5757 - name : " Run linting"
5858 run : |
59+ cp .env.example .env
5960 make test-lint
6061 - name : " Save the linting result"
6162 run : |
Original file line number Diff line number Diff line change @@ -11,7 +11,13 @@ RUN npm run compile
1111FROM python:3.13.5-alpine3.21 AS python_base
1212
1313ENV PYTHONDONTWRITEBYTECODE=1 \
14- PYTHONUNBUFFERED=1
14+ PYTHONUNBUFFERED=1 \
15+ VIRTUAL_ENV=/app/.venv \
16+ PATH="/app/.venv/bin:$PATH" \
17+ USER=app
18+
19+ RUN addgroup --gid 1000 --system ${USER} \
20+ && adduser --uid 1000 --system ${USER} --ingroup ${USER}
1521
1622FROM python_base AS builder
1723
@@ -26,15 +32,21 @@ COPY pyproject.toml poetry.lock ./
2632RUN pip install poetry
2733RUN poetry install --without dev --no-root && rm -rf $POETRY_CACHE_DIR
2834
35+ FROM builder AS development
2936
30- FROM python_base
37+ USER ${USER}
38+ WORKDIR /app
3139
32- ENV VIRTUAL_ENV=/app/.venv \
33- PATH="/app/.venv/bin:$PATH" \
34- USER=app
40+ COPY --chown=${USER}:${USER} . .
3541
36- RUN addgroup --gid 1000 --system ${USER} \
37- && adduser --uid 1000 --system ${USER} --ingroup ${USER}
42+ USER root
43+
44+ RUN chown ${USER}:${USER} .
45+ RUN poetry install
46+
47+ USER ${USER}
48+
49+ FROM python_base
3850
3951USER ${USER}
4052WORKDIR /app
Original file line number Diff line number Diff line change 22
33services :
44 web :
5- build : .
5+ build :
6+ context : .
7+ dockerfile : Dockerfile
8+ target : development
69 command : python manage.py runserver 0.0.0.0:8000
710 ports :
811 - " 8000:8000"
912 env_file :
1013 - .env
1114 depends_on :
1215 - db
13- volumes :
14- - ./lung_cancer_screening:/app/lung_cancer_screening
1516 restart : unless-stopped
1617
1718 asset_builder :
Original file line number Diff line number Diff line change 11.PHONY : dev-run dev-up dev-down dev-logs dev-shell dev-migrate dev-makemigrations dev-clean dev-test
22
3+ DOCKER_COMPOSE_CMD = docker compose
4+
35dev-build :
4- docker-compose build
6+ $( DOCKER_COMPOSE_CMD ) build
57
68dev-run :
7- docker-compose up --build
9+ $( DOCKER_COMPOSE_CMD ) up --build
810
911dev-up :
10- docker-compose up -d --build
12+ $( DOCKER_COMPOSE_CMD ) up -d --build
1113
1214dev-down :
13- docker-compose down
15+ $( DOCKER_COMPOSE_CMD ) down
1416
1517dev-logs :
16- docker-compose logs -f
18+ $( DOCKER_COMPOSE_CMD ) logs -f
1719
1820dev-shell :
19- docker-compose run web sh
21+ $( DOCKER_COMPOSE_CMD ) run web sh
2022
2123dev-migrate :
22- docker-compose run --rm web python manage.py migrate
24+ $( DOCKER_COMPOSE_CMD ) run --rm web python manage.py migrate
2325
2426dev-makemigrations :
25- docker-compose run --rm web python manage.py makemigrations
27+ $( DOCKER_COMPOSE_CMD ) run --rm web python manage.py makemigrations
2628
2729dev-clean :
28- docker-compose down -v --remove-orphans
29- docker system prune -f
30+ $( DOCKER_COMPOSE_CMD ) down -v --remove-orphans
31+ $( DOCKER_COMPOSE_CMD ) system prune -f
3032
3133dev-test :
32- docker-compose run --rm web python manage.py test
34+ $( DOCKER_COMPOSE_CMD ) run --rm web python manage.py test
Original file line number Diff line number Diff line change @@ -16,6 +16,9 @@ dependencies = [
1616[tool .poetry ]
1717package-mode = false
1818
19+ [tool .poetry .group .dev .dependencies ]
20+ ruff = " ^0.12.5"
21+
1922[build-system ]
2023requires = [" poetry-core>=2.0.0,<3.0.0" ]
2124build-backend = " poetry.core.masonry.api"
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ set -euo pipefail
4+
5+ cd " $( git rev-parse --show-toplevel) "
6+
7+ # This file is for you! Edit it to call your unit test suite. Note that the same
8+ # file will be called if you run it locally as if you run it on CI.
9+
10+ # Replace the following line with something like:
11+ #
12+ # rubocop
13+ # python manage.py lint
14+ # npm run lint
15+ #
16+ # or whatever is appropriate to your project. You should *only* run your fast
17+ # tests from here. If you want to run other test suites, see the predefined
18+ # tasks in scripts/lint.mk.
19+
20+ docker compose run --rm web poetry run ruff check lung_cancer_screening
Original file line number Diff line number Diff line change @@ -17,4 +17,4 @@ cd "$(git rev-parse --show-toplevel)"
1717# tests from here. If you want to run other test suites, see the predefined
1818# tasks in scripts/test.mk.
1919
20- docker compose run web python manage.py test
20+ docker compose run web poetry run python manage.py test
You can’t perform that action at this time.
0 commit comments