Compare commits
No commits in common. "ca73d6ca795e783219d1d54fc126283dab0fd3d0" and "d7bd69f68c8cca3ba3484cf0ab78d8daa0db779e" have entirely different histories.
ca73d6ca79
...
d7bd69f68c
@ -1,55 +1,30 @@
|
|||||||
# Git
|
# Git files
|
||||||
.git
|
.git
|
||||||
.gitignore
|
.gitignore
|
||||||
|
|
||||||
# Python
|
# Virtual environment
|
||||||
|
.venv
|
||||||
|
venv/
|
||||||
|
env/
|
||||||
|
ENV/
|
||||||
|
*.env # Ignore local .env files within the backend directory if any
|
||||||
|
|
||||||
|
# Python cache
|
||||||
__pycache__/
|
__pycache__/
|
||||||
*.py[cod]
|
*.py[cod]
|
||||||
*$py.class
|
*$py.class
|
||||||
*.so
|
|
||||||
.Python
|
|
||||||
env/
|
|
||||||
build/
|
|
||||||
develop-eggs/
|
|
||||||
dist/
|
|
||||||
downloads/
|
|
||||||
eggs/
|
|
||||||
.eggs/
|
|
||||||
lib/
|
|
||||||
lib64/
|
|
||||||
parts/
|
|
||||||
sdist/
|
|
||||||
var/
|
|
||||||
*.egg-info/
|
|
||||||
.installed.cfg
|
|
||||||
*.egg
|
|
||||||
|
|
||||||
# Virtual Environment
|
# IDE files
|
||||||
venv/
|
|
||||||
ENV/
|
|
||||||
|
|
||||||
# IDE
|
|
||||||
.idea/
|
.idea/
|
||||||
.vscode/
|
.vscode/
|
||||||
*.swp
|
|
||||||
*.swo
|
|
||||||
|
|
||||||
# Logs
|
# Test artifacts
|
||||||
*.log
|
|
||||||
|
|
||||||
# Local development
|
|
||||||
.env
|
|
||||||
.env.local
|
|
||||||
.env.*.local
|
|
||||||
|
|
||||||
# Docker
|
|
||||||
Dockerfile*
|
|
||||||
docker-compose*
|
|
||||||
.dockerignore
|
|
||||||
|
|
||||||
# Tests
|
|
||||||
tests/
|
|
||||||
test/
|
|
||||||
.pytest_cache/
|
.pytest_cache/
|
||||||
.coverage
|
|
||||||
htmlcov/
|
htmlcov/
|
||||||
|
.coverage*
|
||||||
|
|
||||||
|
# Other build/temp files
|
||||||
|
*.egg-info/
|
||||||
|
dist/
|
||||||
|
build/
|
||||||
|
*.db # e.g., sqlite temp dbs
|
@ -1,43 +1,35 @@
|
|||||||
# be/Dockerfile
|
# be/Dockerfile
|
||||||
|
|
||||||
# Use multi-stage build
|
# Choose a suitable Python base image
|
||||||
FROM python:alpine AS builder
|
|
||||||
|
|
||||||
# Set environment variables
|
|
||||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
||||||
PYTHONUNBUFFERED=1 \
|
|
||||||
PIP_NO_CACHE_DIR=1 \
|
|
||||||
PIP_DISABLE_PIP_VERSION_CHECK=1
|
|
||||||
|
|
||||||
# Install build dependencies
|
|
||||||
RUN apk add --no-cache \
|
|
||||||
gcc \
|
|
||||||
musl-dev \
|
|
||||||
postgresql-dev
|
|
||||||
|
|
||||||
# Create and activate virtual environment
|
|
||||||
RUN python -m venv /opt/venv
|
|
||||||
ENV PATH="/opt/venv/bin:$PATH"
|
|
||||||
|
|
||||||
# Install dependencies
|
|
||||||
COPY requirements.txt .
|
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
|
||||||
|
|
||||||
# Final stage
|
|
||||||
FROM python:alpine
|
FROM python:alpine
|
||||||
|
|
||||||
# Copy virtual environment from builder
|
# Set environment variables
|
||||||
COPY --from=builder /opt/venv /opt/venv
|
ENV PYTHONDONTWRITEBYTECODE 1 # Prevent python from writing pyc files
|
||||||
ENV PATH="/opt/venv/bin:$PATH"
|
ENV PYTHONUNBUFFERED 1 # Keep stdout/stderr unbuffered
|
||||||
|
|
||||||
# Set working directory
|
# Set the working directory in the container
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Copy application code
|
# Install system dependencies if needed (e.g., for psycopg2 build)
|
||||||
COPY . .
|
# RUN apt-get update && apt-get install -y --no-install-recommends gcc build-essential libpq-dev && rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Expose port
|
# Install Python dependencies
|
||||||
|
# Upgrade pip first
|
||||||
|
RUN pip install --no-cache-dir --upgrade pip
|
||||||
|
# Copy only requirements first to leverage Docker cache
|
||||||
|
COPY requirements.txt requirements.txt
|
||||||
|
# Install dependencies
|
||||||
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
|
# Copy the rest of the application code into the working directory
|
||||||
|
COPY . .
|
||||||
|
# This includes your 'app/' directory, alembic.ini, etc.
|
||||||
|
|
||||||
|
# Expose the port the app runs on
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
|
|
||||||
# Run the application
|
# Command to run the application using uvicorn
|
||||||
|
# The default command for production (can be overridden in docker-compose for development)
|
||||||
|
# Note: Make sure 'app.main:app' correctly points to your FastAPI app instance
|
||||||
|
# relative to the WORKDIR (/app). If your main.py is directly in /app, this is correct.
|
||||||
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
Loading…
Reference in New Issue
Block a user