Skip to content

Commit 4c43989

Browse files
committed
update to uv
1 parent fdb9320 commit 4c43989

15 files changed

+316
-529
lines changed

.github/workflows/pyci.yml

+11-9
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,21 @@ jobs:
4545
if: ${{ github.event_name == 'push' }}
4646

4747
steps:
48-
- uses: actions/checkout@v2
49-
50-
- uses: docker/setup-buildx-action@v1
48+
- uses: actions/checkout@v4
49+
- uses: docker/setup-buildx-action@v3
5150

52-
- uses: docker/login-action@v1
51+
- name: Log in to GitHub Container Registry
52+
uses: docker/login-action@v3
5353
with:
54-
username: ${{ secrets.DOCKER_USERNAME }}
55-
password: ${{ secrets.DOCKER_PASSWORD }}
54+
registry: ghcr.io
55+
username: ${{ github.actor }}
56+
password: ${{ secrets.GITHUB_TOKEN }}
5657

57-
- uses: docker/build-push-action@v2
58+
- name: Build and push
59+
uses: docker/build-push-action@v6
5860
with:
5961
context: .
6062
push: true
61-
cache-from: hexletcomponents/python-django-blog:latest
63+
cache-from: ghcr.io/${{ github.repository }}:latest
6264
cache-to: type=inline
63-
tags: hexletcomponents/python-django-blog:latest
65+
tags: ghcr.io/${{ github.repository }}:latest

Dockerfile

+5-8
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
1-
FROM python:3.8.10-slim
1+
FROM python:3.13.2-slim
22

33
RUN apt-get update && apt-get install -yq make gettext
44

5-
RUN pip3 install -U poetry
6-
RUN poetry config virtualenvs.in-project true
5+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
76

87
WORKDIR /app
98

109
COPY pyproject.toml .
11-
COPY poetry.lock .
10+
COPY uv.lock .
1211

13-
RUN poetry install
12+
RUN uv sync
1413

15-
COPY . .
16-
17-
CMD ["bash", "-c", "make migrate && poetry run gunicorn python_django_blog.wsgi --log-file -"]
14+
CMD ["bash", "-c", "make migrate && uv run gunicorn python_django_blog.wsgi --log-file -"]

Makefile

+16-20
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,46 @@
11
compose-setup: compose-build compose-install
22

33
compose-build:
4-
docker-compose build
4+
docker compose build
55

66
compose-install:
7-
docker-compose run app make install
7+
docker compose run app make install
88

99
compose-bash:
10-
docker-compose run app bash
10+
docker compose run app bash
1111

1212
compose:
13-
docker-compose up
13+
docker compose up
1414

1515
compose-lint:
16-
docker-compose run app make lint
16+
docker compose run app make lint
1717

1818
compose-test:
19-
docker-compose run app make test
19+
docker compose run app make test
2020

2121
install:
22-
poetry install
22+
uv sync
2323

2424
migrate:
25-
poetry run python manage.py migrate
25+
uv run manage.py migrate
2626

2727
setup:
2828
cp -n .env.example .env || true
2929
make install
3030
make migrate
3131

3232
start:
33-
poetry run python manage.py runserver 0.0.0.0:8000
34-
35-
check:
36-
poetry check
33+
uv run manage.py runserver 0.0.0.0:8000
3734

3835
lint:
39-
poetry run flake8 .
36+
uv run ruff check .
4037

4138
test:
42-
poetry run python manage.py test
39+
uv run manage.py test
4340

44-
test-coverage:
45-
poetry run coverage run manage.py test python_django_blog
46-
poetry run coverage html
47-
poetry run coverage report
41+
check: test lint
4842

49-
deploy:
50-
git push heroku main
43+
test-coverage:
44+
uv run coverage run manage.py test python_django_blog
45+
uv run coverage html
46+
uv run coverage report

Procfile

-1
This file was deleted.

docker-compose.yml

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: "3"
2-
31
services:
42
app:
53
build: .

0 commit comments

Comments
 (0)