Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

feat: Add advanced Dockerfile and Docker Compose files #657

Open
wants to merge 1 commit 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
__pycache__
*.pyc
*.pyo
*.pyd
db.sqlite3
.env
11 changes: 10 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
.DS_Store
.DS_Store
__pycache__
*.pyc
*.pyo
*.pyd
*.db
*.log
*.env
*.pyz
*.pyw
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use an official Python image as a parent image
FROM python:3.8-slim

# Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

# Set the working directory inside the container
WORKDIR /app

# Copy only the requirements file into the container
COPY requirements.txt .

# Install any needed packages specified in requirements.txt
RUN pip install --no-cache-dir -r requirements.txt

# Copy the rest of your application code into the container
COPY . .

# Collect static files if applicable (for Django, Flask, etc.)
# RUN python manage.py collectstatic --noinput

# Expose the necessary port (if your app listens on a specific port)
EXPOSE 8000

# Define the command to run your application
CMD [ "python", "app.py" ]
11 changes: 11 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: '3'
services:
app:
build:
context: .
dockerfile: Dockerfile
command: ["python", "app.py"]
volumes:
- .:/app
ports:
- "8000:8000"
7 changes: 7 additions & 0 deletions docker-compose.prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: '3'
services:
app:
build:
context: .
dockerfile: Dockerfile
command: ["gunicorn", "-w", "4", "-b", "0.0.0.0:8000", "app:app"]