commit 9715adb1159d78c0d887ba7d2223ebbe8cb57b86 Author: Andros Fenollosa Date: Mon Nov 4 12:08:20 2024 +0100 First commit diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c3ea3de --- /dev/null +++ b/Dockerfile @@ -0,0 +1,29 @@ +FROM python:3.12-slim + +# Prevents Python from writing pyc files to disc (equivalent to python -B option) +ENV PYTHONDONTWRITEBYTECODE=1 +# Prevents Python from buffering stdout and stderr (equivalent to python -u option) +ENV PYTHONUNBUFFERED=1 + +# set work directory +WORKDIR /usr/src/app/ + +# set time +RUN ln -fs /usr/share/zoneinfo/Europe/Madrid /etc/localtime +RUN dpkg-reconfigure -f noninteractive tzdata + +# install software +RUN apt-get update && apt-get install -y \ + build-essential \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +# install dependencies +RUN pip3 install --upgrade pip + +COPY ./requirements.txt . +RUN pip3 install -r requirements.txt + +EXPOSE 8000 + +ENTRYPOINT ["python3", "manage.py", "runserver", "0.0.0.0:8000"] diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 0000000..760d6d1 --- /dev/null +++ b/compose.yaml @@ -0,0 +1,33 @@ +services: + + redis: + image: redis:alpine + restart: "no" + healthcheck: + test: ["CMD", "redis-cli", "ping"] + interval: 30s + timeout: 60s + retries: 5 + expose: + - 6379 + + django: + build: + context: . + restart: "no" + volumes: + - .:/usr/src/app/ + ports: + - 8000:8000 + - redis + + huey: + build: . + restart: "no" + entrypoint: huey_consumer.py app.huey -w 4 -k process -f + volumes: + - .:/usr/src/app + environment: + - STORE_URI=redis://redis:6379/0 + depends_on: + - redis diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..0a7e86e --- /dev/null +++ b/requirements.txt @@ -0,0 +1,12 @@ +# Django +Django==5.1.2 +daphne==4.1.2 +asgiref==3.8.1 + +# Django Channels +channels==4.1.0 +redis==5.2.0 +asgi_redis==1.4.3 + +# Task queue +huey==2.5.2