-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
39 lines (30 loc) · 1018 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
FROM python:3.11-slim-bullseye
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
POETRY_VERSION=1.6.1
# Install system dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
librocksdb-dev \
curl && \
rm -rf /var/lib/apt/lists/*
# Install Poetry
RUN curl -sSL https://install.python-poetry.org | python3 - && \
ln -s /root/.local/bin/poetry /usr/local/bin/poetry
# Copy project files
WORKDIR /app
COPY pyproject.toml poetry.lock ./
# Install Python dependencies
RUN poetry config virtualenvs.create false && \
poetry install --no-interaction --no-ansi --no-dev
# Copy the rest of the project
COPY . .
# Expose the application port
EXPOSE 8000
# Health check (optional)
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s \
CMD curl -f http://localhost:8000/health || exit 1
# Command to run the FastAPI app
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]