
# file: docker-compose.yml

~~~yml
version: "3"
name: transporte-cms

services:
  app:
    image: python:3.11-alpine
    restart: unless-stopped
    volumes:
      - .:/app
      - venv:/root/venv
    working_dir: /app
    environment:
      PORT: 8000
    command: sh -c "
      [ -d /root/venv/bin ] || ( \
        python -m venv /root/venv/ \
        && . /root/venv/bin/activate \
        && pip install -r ./myproject/requirements.txt \
      ) ;

      . /root/venv/bin/activate ;

      cd /app ;
      [ -d myproject ] || (django-admin startproject myproject) ;
      chmod -R o+w myproject/ ;
      [ -f .env ] || ([ -f .env.develop ] && cp .env.develop .env) ;
      python myproject/manage.py runserver 0.0.0.0:$$PORT
      "
networks:
  default:
    external:
      name: transporte_default

volumes:
  venv:
~~~


