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

Commit

Permalink
feat: Add advanced Dockerfile and Docker Compose files
Browse files Browse the repository at this point in the history
  • Loading branch information
SimardeepSingh-zsh committed Oct 14, 2023
1 parent b6f12e2 commit 98bcf1a
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 1 deletion.
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"]

0 comments on commit 98bcf1a

Please sign in to comment.