-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
95592eb
commit 600a8af
Showing
2 changed files
with
46 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Exclude Python cache files | ||
__pycache__ | ||
*.pyc | ||
*.pyo | ||
*.pyd | ||
|
||
# Exclude virtual environments | ||
venv/ | ||
env/ | ||
.venv/ | ||
.env/ | ||
|
||
# Exclude version control directories | ||
.git | ||
.gitignore | ||
|
||
# Exclude Dockerfile and Docker-related files if not needed | ||
Dockerfile | ||
docker-compose.yml | ||
|
||
# Exclude other unnecessary files and directories | ||
node_modules/ | ||
dist/ | ||
build/ | ||
*.log | ||
*.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,32 @@ | ||
# Use an updated Python image | ||
FROM python:3.12-bookworm | ||
|
||
# Install dependencies | ||
RUN apt-get update && apt-get install -y libsnappy-dev | ||
# Set environment variables to prevent Python from writing .pyc files and buffering stdout/stderr | ||
ENV PYTHONDONTWRITEBYTECODE=1 | ||
ENV PYTHONUNBUFFERED=1 | ||
|
||
# Install dependencies in one layer for faster builds | ||
RUN apt-get update && \ | ||
apt-get install -y libsnappy-dev && \ | ||
apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|
||
# Install uv package manager | ||
RUN pip install --no-cache-dir uv | ||
|
||
# Set the working directory in the container | ||
WORKDIR /app | ||
|
||
# First, copy only the requirements.txt file | ||
COPY requirements.txt . | ||
# Copy only requirements.txt first to leverage caching | ||
COPY requirements.txt ./ | ||
|
||
# Install any needed packages specified in requirements.txt | ||
RUN pip install --no-cache-dir -r requirements.txt | ||
# Install Python dependencies using uv | ||
RUN uv --install -r requirements.txt | ||
|
||
# Now copy the rest of the application code into the container | ||
# Copy the rest of the application code into the container | ||
COPY . . | ||
|
||
# Add .dockerignore to reduce build context | ||
# (Ensure .dockerignore is properly configured to exclude unnecessary files) | ||
|
||
# Command to run the application | ||
CMD ["python3", "main.py"] | ||
CMD ["python3", "main.py"] |