Compare commits

...

4 commits

3 changed files with 187 additions and 11 deletions

View file

@ -0,0 +1,97 @@
# title
Short and specific: **a clear summary of the bug**.
It should also be **searchable**, so developers can find it in a pinch.
> Tips on writing great titles:
>
> 1. Keep it simple, but descriptive.
> 2. Dont abbreviate.
> 3. Make it searchable.
> 4. Focus on the technical problem.
> 5. Highlight the specific feature/component you have issues with.
## description
Small text to describe the bug with human words.
## steps to reproduce
**Describe how you found the bug**, so the developer can try to reproduce it.
> Tips on writing reproducible steps:
>
> 1. Use a numbered list so its easy to follow.
> 2. This is your chance to be comprehensive and (reasonably) verbose. Dont leave out any details!
## expected vs. actual results
Take some time to explain what **should** happen vs. what **actually** happened.
If you just describe the bug, some people might think youre describing the expected behavior.
### expected results
### actual results
> Tips for writing expected vs. actual results:
>
> 1. Use a direct comparison format. For example, "*The button should turn green*" vs. "*The button is turning blue*".
> 2. Be precise. Simply stating "*it went wrong*" instead of *"the page loads indefinitely*" means you are leaving out very valuable information!
## visual proof/screenshot
Screenshots and annotations help developers **visualize the bug**, and pinpoint its location on the page.
> Tips on taking great screenshots:
>
> 1. Annotations go a long way towards driving your point across.
> 2. Highlight the problematic element. Dont be ambiguous.
> 3. Use big fonts, different colors, etc. - the bug needs to be even more obvious here than in your summary.
> 4. For complicated issues, record a short video! This adds a ton of helpful context when trying to reproduce bugs.
## priority
The urgency and **potential impact of the bug**. Determines how quickly it needs to be fixed.
> How to determine priority/severity:
>
> 1. Critical: blocking bugs that **directly prevent business**. Example: a checkout page not loading.
> 2. High: affects **major features**, but non-breaking. E.g.: the search bar on an e-commerce website.
> 3. Medium: noticeable bugs that **disrupt normal use**. E.g.: broken link, long loading times.
> 4. Low: **small issues** and enhancements: typos, missing images...
## environment
For developers to reproduce and fix your bug, theyll need to know your **browser version**, **screen size**, **operating system**...
Some bugs only occur within specific environments.
- source url:
- operating system:
- browser:
- viewport:
> How to find your environment info:
>
> 1. **Browser and version**: look for a “Help” or “About” option in your browsers menu.
> 2. **Operating system**: on PC, press the Windows key + Pause/break. On a Mac, click the Apple logo and choose “About this Mac”.
> 3. **Screen size**: look in your computers display settings, or search online for “screen resolution” along with your device model.
## console logs
This is where your web browser **shows errors or warnings**.
Console logs can help developers figure out what went wrong.
```log
console log
```
> How to access your console logs:
>
> 1. Right-click the page, select “Inspect” or “Inspect Element”, then click on the “Console” tab.
> 2. Try to make the bug happen again and see if any messages pop up there.
## credits https://www.perfectbugreport.io/

View file

@ -1,16 +1,81 @@
FROM python:3.11-slim # Stage 1: General debian environment
FROM debian:stable-slim AS linux-base
WORKDIR /srv/app # Assure UTF-8 encoding is used.
ENV LC_CTYPE=C.utf8
# Location of the virtual environment
ENV UV_PROJECT_ENVIRONMENT="/venv"
# Location of the python installation via uv
ENV UV_PYTHON_INSTALL_DIR="/python"
# Byte compile the python files on installation
ENV UV_COMPILE_BYTECODE=1
# Python verision to use
ENV UV_PYTHON=python3.12
# Tweaking the PATH variable for easier use
ENV PATH="$UV_PROJECT_ENVIRONMENT/bin:$PATH"
RUN apt update && \ # Update debian
apt install --no-install-recommends -y libpq-dev build-essential curl gcc sassc libpango-1.0-0 libpangoft2-1.0-0 libjpeg-dev libopenjp2-7-dev libffi-dev libpangoft2-1.0-0 libcairo2 libpangocairo-1.0-0 libgdk-pixbuf2.0-0 shared-mime-info gettext &&\ RUN apt-get update
rm -rf /var/lib/apt/lists/* RUN apt-get upgrade -y
COPY --chown=www-data:www-data . . # Install general required dependencies
RUN apt-get install --no-install-recommends -y tzdata \
libpango-1.0-0 \
libpangoft2-1.0-0 \
libjpeg-dev \
libopenjp2-7-dev \
libffi-dev \
libpangoft2-1.0-0 \
libcairo2 \
libpangocairo-1.0-0 \
libgdk-pixbuf2.0-0 \
shared-mime-info \
gettext \
tini
run python -m pip install --upgrade pip \ # Stage 2: Python environment
&& python -m pip install uwsgi \ FROM linux-base AS python-base
&& python -m pip install -r requirements.txt \
&& python -m pip install .
ENTRYPOINT [ "uwsgi", "-i", "uwsgi.ini" ] # Install debian dependencies
RUN apt-get install --no-install-recommends -y \
libpq-dev \
build-essential \
curl \
gcc \
sassc
# Install uv
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
# Create virtual environment and install dependencies
COPY pyproject.toml ./
COPY uv.lock ./
RUN uv sync --frozen --no-dev --no-install-project
RUN uv pip install granian
# Stage 3: Building environment
FROM python-base AS builder-base
WORKDIR /app
COPY . /app
# Build static files
RUN python manage.py compilescss
RUN python manage.py collectstatic --no-input
# Compile translation files
# RUN python manage.py compilemessages
# Stage 4: Webapp environment
FROM linux-base AS webapp
# Copy python, virtual env and static assets
COPY --from=builder-base $UV_PYTHON_INSTALL_DIR $UV_PYTHON_INSTALL_DIR
COPY --from=builder-base $UV_PROJECT_ENVIRONMENT $UV_PROJECT_ENVIRONMENT
COPY --from=builder-base /app /app
# Start the application server
WORKDIR /app
EXPOSE 8000
CMD ["docker/entrypoint.sh"]

14
docker/entrypoint.sh Executable file
View file

@ -0,0 +1,14 @@
#!/usr/bin/env bash
set -euxo pipefail
echo "Migrate database..."
python manage.py migrate --settings local_settings
echo "Start server..."
granian la_chariotte.wsgi:application \
--host 127.0.0.1 \
--port 8000 \
--interface wsgi \
--no-ws \
--loop uvloop