initial - add implementation for simple crowdsec app to list and delete non-CAPI decisions
This commit is contained in:
commit
9aaf3d32d0
7 changed files with 349 additions and 0 deletions
34
Dockerfile
Normal file
34
Dockerfile
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
# ---- Stage 1: Build dependencies ----
|
||||
FROM python:3.12-slim AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Install build dependencies
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends build-essential
|
||||
|
||||
# Copy requirement files
|
||||
COPY requirements.txt .
|
||||
|
||||
# Install to a local folder
|
||||
RUN pip install --prefix=/install -r requirements.txt
|
||||
|
||||
# ---- Stage 2: Runtime ----
|
||||
FROM python:3.12-slim
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy installed packages
|
||||
COPY --from=builder /install /usr/local
|
||||
|
||||
# Copy app source
|
||||
COPY . .
|
||||
|
||||
# Create non-root user
|
||||
RUN useradd -m fastapiuser && chown -R fastapiuser /app
|
||||
USER fastapiuser
|
||||
|
||||
# Expose FastAPI port
|
||||
EXPOSE 8000
|
||||
|
||||
# Start app with uvicorn
|
||||
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||
Loading…
Add table
Add a link
Reference in a new issue