Sign inSign up

vnvsa/slurpy

By vnvsa

Updated 3 days ago

Image
0

5.8K

vnvsa/slurpy repository overview

Python container (Docker container for Python web development)

Docker container allowing you to build and test your Python project.

This container mainly targets Python web project developments (Understand Django) but you can try to make it work with your project even if your project is not using web technologies.

Tools installed
  • pip - The PyPA recommended tool for installing Python packages.
  • poetry - Python packaging and dependency management made easy
  • uv - An extremely fast Python package and project manager, written in Rust.
Dependencies installed

Supported versions:

Debian
  • Bullseye
  • Bookworm
Python
  • 3.10
  • 3.11
  • 3.12
  • 3.13

Use the container

We recommend you to use the dev user instead of root when running that container.

The container's working directory is /var/www/app so we advise you to mount your project directory onto this place.

docker-compose.yml

services:
  django:
    container_name: my-super-django-app
    build:
      dockerfile: ./docker/django/Dockerfile
      context: .
    environment:
      PYTHONUNBUFFERED: 1
    ports:
      - "8000:8000"
    entrypoint: ./docker/django-entrypoint.sh
    volumes:
      - ./:/var/www/app
      - ./log:/var/log/django/

./docker/django-entrypoint.sh

#!/usr/bin/env bash

poetry install
poetry run python manage.py migrate
poetry run python manage.py loaddata fixtures/groups.yaml
poetry run python manage.py loaddata fixtures/transaction_types.yaml
poetry run python manage.py loaddata fixtures/wallet_types.yaml
poetry run python manage.py collectstatic --noinput
export LOG_HANDLER='file'
poetry run python manage.py runserver 0.0.0.0:8000

./docker/django/Dockerfile

FROM vnvsa/python:3.12

USER root

# Install system deps
RUN apt-get update --yes && \
    apt-get install --yes \
    unixodbc  \
    unixodbc-dev \
    wget \
    cron

# Install python deps
RUN pip install --upgrade pip && \
    pip install pyodbc && \
    mkdir -p /var/log/django/ && \
    chown dev:dev /var/log/django/

USER dev
Poetry up

Run using a compose configuration:

docker compose run --entrypoint="poetry up --latest" django
Troubleshooting
Poetry version is too recent

Update your Dockerfile to install the version of poetry you need.

FROM vnvsa/python:3.12

USER root

RUN pip install poetry==1.8.3 \
    && pip cache purge

USER dev

Contributing

Pull requests, bug reports, and feature requests are welcome.

Contacts

License

MIT License. See the LICENSE file.

Tag summary

Content type

Image

Digest

sha256:21c4a4b4f

Size

977 MB

Last updated

3 days ago

docker pull vnvsa/slurpy:3.10-bookworm