Files
opsxsql/backend/Dockerfile
T

32 lines
692 B
Docker

FROM python:3.11-slim
WORKDIR /app
# Install system deps
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc libffi-dev && \
rm -rf /var/lib/apt/lists/*
# Install Python deps
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy app
COPY . .
# Default env
ENV DATABASE_URL="sqlite+aiosqlite:///./data/sqlite3.db"
ENV SECRET_KEY="change-me-in-production"
ENV ADMIN_USERNAME="admin"
ENV ADMIN_PASSWORD="changeme"
ENV ENV="production"
ENV DEBUG="false"
# Create data dir
RUN mkdir -p /app/data
EXPOSE 9000
# Run alembic + uvicorn
CMD ["sh", "-c", "alembic upgrade head && python -m uvicorn app.main:app --host 0.0.0.0 --port 9000"]