Skip to content

Commit 6cb75a1

Browse files
committed
updated server Docker to use uv too
1 parent 57063c9 commit 6cb75a1

2 files changed

Lines changed: 11 additions & 13 deletions

File tree

docker/server/Dockerfile

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
1-
FROM python:3.12-slim
1+
FROM astral/uv:0.9-python3.14-bookworm-slim
22

3-
RUN apt-get update && apt-get install --yes --no-install-recommends g++ libssl-dev && rm -rf /var/lib/apt/lists/*
4-
5-
RUN pip install --upgrade pip && pip install uv
3+
RUN apt-get update && apt-get upgrade --yes && apt-get install --yes --no-install-recommends g++ libssl-dev && rm -rf /var/lib/apt/lists/*
64

75
WORKDIR /app
86

97
COPY ./docker/server/entrypoint.sh /entrypoint.sh
108

119
COPY ./server/pyproject.toml ./server/uv.lock ./
1210

13-
RUN uv sync
11+
RUN uv sync --frozen
1412

1513
COPY ./server ./
1614

1715
RUN chmod +x /entrypoint.sh
18-
CMD ["/entrypoint.sh"]
16+
CMD ["/entrypoint.sh"]

docker/server/entrypoint.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
#!/bin/bash
22

33
echo "Applying database migrations"
4-
python manage.py migrate --noinput
4+
uv run python manage.py migrate --noinput
55

66
echo "Collecting static files"
7-
python manage.py collectstatic --noinput
7+
uv run python manage.py collectstatic --noinput
88

99
# Create Django Superuser
1010
echo "Creating Django Superuser"
11-
python manage.py createsuperuser --noinput
11+
uv run python manage.py createsuperuser --noinput
1212

1313
# Run inbuilt Django server if ENV is development
1414
if [ "${APP_ENV^^}" = "DEVELOPMENT" ]; then
1515

1616
# Install extra non-prod packages
1717
printf "\n" && echo "Installing dev dependencies for $APP_ENV"
18-
uv sync
18+
uv sync --frozen --all-groups
1919
# Run developments
2020
printf "\n" && echo "Starting inbuilt django webserver"
2121
echo "Running: python manage.py runserver 0.0.0.0:8081"
22-
python manage.py runserver 0.0.0.0:8081
22+
uv run python manage.py runserver 0.0.0.0:8081
2323
exit
2424
fi
2525

@@ -31,5 +31,5 @@ if [ "${APP_ENV^^}" = "PRODUCTION" ]; then
3131
# Run Gunicorn / Django
3232
printf "\n" && echo " Running Gunicorn / Django"
3333
echo "Running: gunicorn api.wsgi -b 0.0.0.0:8081 --workers=6 --keep-alive 20 --log-file=- --log-level debug --access-logfile=/var/log/accesslogs/gunicorn --capture-output --timeout 50"
34-
gunicorn api.wsgi -b 0.0.0.0:8081 --workers=6 --keep-alive 20 --log-file=- --log-level debug --access-logfile=/var/log/accesslogs/gunicorn --capture-output --timeout 50
35-
fi
34+
uv run gunicorn api.wsgi -b 0.0.0.0:8081 --workers=6 --keep-alive 20 --log-file=- --log-level debug --access-logfile=/var/log/accesslogs/gunicorn --capture-output --timeout 50
35+
fi

0 commit comments

Comments
 (0)