diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f206168 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,30 @@ +# Use the official Python image as a parent image +FROM python:3.11 + +# Set environment variables +ENV PYTHONDONTWRITEBYTECODE 1 +ENV PYTHONUNBUFFERED 1 + +# Set the working directory in the container +WORKDIR /code + +# Copy the requirements file into the container at /code +COPY requirements.txt /code/ + +# Install dependencies +RUN pip install -r requirements.txt + +# Copy the run script into the container +COPY run.sh /code/run.sh + +# Grant execute permissions to the run script +RUN chmod +x /code/run.sh + +# Copy the current directory contents into the container at /code +COPY . /code/ + +# Set the run to the custom script +ENTRYPOINT ["/code/run.sh"] + +# Command to run the application +CMD ["python", "manage.py", "runserver", "0.0.0.0:8080"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..643f0c2 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,10 @@ +version: '3.8' + +services: + web: + build: . + command: python manage.py runserver 0.0.0.0:8080 + volumes: + - .:/code + ports: + - "8080:8080" diff --git a/manage.py b/manage.py old mode 100644 new mode 100755 diff --git a/requirements.txt b/requirements.txt index 13d2385..7e8b54e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,6 @@ -django -djangorestframework -Pillow -django-cors-headers \ No newline at end of file +Django==5.0.1 +django-cors-headers==4.3.1 +djangorestframework==3.14.0 +Pillow==9.5.0 +djangorestframework-simplejwt +djoser diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..8b08cc1 --- /dev/null +++ b/run.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +# Apply migrations +python manage.py migrate + +# Start the Django development server +exec "$@"