Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerfile and setting the versions in requirements.txt #4

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
10 changes: 10 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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"
Empty file modified manage.py
100644 → 100755
Empty file.
10 changes: 6 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
django
djangorestframework
Pillow
django-cors-headers
Django==5.0.1
django-cors-headers==4.3.1
djangorestframework==3.14.0
Pillow==9.5.0
djangorestframework-simplejwt
djoser
7 changes: 7 additions & 0 deletions run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

# Apply migrations
python manage.py migrate

# Start the Django development server
exec "$@"