mirror of
https://framagit.org/la-chariotte/la-chariotte.git
synced 2025-05-01 11:22:24 +02:00
Use granian as a WSGI server
This commit is contained in:
parent
5a4260ed42
commit
9f8be6d52d
3 changed files with 14 additions and 16 deletions
|
@ -31,8 +31,7 @@ RUN apt-get install --no-install-recommends -y tzdata \
|
||||||
libgdk-pixbuf2.0-0 \
|
libgdk-pixbuf2.0-0 \
|
||||||
shared-mime-info \
|
shared-mime-info \
|
||||||
gettext \
|
gettext \
|
||||||
tini \
|
tini
|
||||||
uwsgi
|
|
||||||
|
|
||||||
# Stage 2: Python environment
|
# Stage 2: Python environment
|
||||||
FROM linux-base AS python-base
|
FROM linux-base AS python-base
|
||||||
|
@ -52,6 +51,7 @@ COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
|
||||||
COPY pyproject.toml ./
|
COPY pyproject.toml ./
|
||||||
COPY uv.lock ./
|
COPY uv.lock ./
|
||||||
RUN uv sync --frozen --no-dev --no-install-project
|
RUN uv sync --frozen --no-dev --no-install-project
|
||||||
|
RUN uv pip install granian
|
||||||
|
|
||||||
# Stage 3: Building environment
|
# Stage 3: Building environment
|
||||||
FROM python-base AS builder-base
|
FROM python-base AS builder-base
|
||||||
|
@ -60,10 +60,12 @@ WORKDIR /app
|
||||||
COPY . /app
|
COPY . /app
|
||||||
|
|
||||||
# Build static files
|
# Build static files
|
||||||
|
RUN python manage.py compilescss
|
||||||
RUN python manage.py collectstatic --no-input
|
RUN python manage.py collectstatic --no-input
|
||||||
|
|
||||||
# Compile translation files
|
# Compile translation files
|
||||||
RUN python manage.py compilemessages
|
# RUN python manage.py compilemessages
|
||||||
|
|
||||||
|
|
||||||
# Stage 4: Webapp environment
|
# Stage 4: Webapp environment
|
||||||
FROM linux-base AS webapp
|
FROM linux-base AS webapp
|
||||||
|
|
|
@ -2,7 +2,13 @@
|
||||||
set -euxo pipefail
|
set -euxo pipefail
|
||||||
|
|
||||||
echo "Migrate database..."
|
echo "Migrate database..."
|
||||||
python manage.py migrate
|
python manage.py migrate --settings local_settings
|
||||||
|
|
||||||
echo "Start uwsgi..."
|
echo "Start server..."
|
||||||
exec uwsgi --ini docker/uwsgi.ini
|
|
||||||
|
granian la_chariotte.wsgi:application \
|
||||||
|
--host 127.0.0.1 \
|
||||||
|
--port 8000 \
|
||||||
|
--interface wsgi \
|
||||||
|
--no-ws \
|
||||||
|
--loop uvloop
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
[uwsgi]
|
|
||||||
http = :$(PORT)
|
|
||||||
home = /venv
|
|
||||||
module = la_chariotte.wsgi:application
|
|
||||||
master = True
|
|
||||||
vacuum = True
|
|
||||||
max-requests = 5000
|
|
||||||
processes = 4
|
|
||||||
enable-threads = true
|
|
||||||
buffer-size = 32768
|
|
Loading…
Reference in a new issue