First commit

This commit is contained in:
Andros Fenollosa 2024-11-04 12:08:20 +01:00
commit 9715adb115
3 changed files with 74 additions and 0 deletions

29
Dockerfile Normal file
View File

@ -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"]

33
compose.yaml Normal file
View File

@ -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

12
requirements.txt Normal file
View File

@ -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