-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathDockerfile
35 lines (25 loc) · 1.01 KB
/
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
FROM python:3.11.7
# Keeps Python from generating .pyc files in the container
ENV PYTHONDONTWRITEBYTECODE=1
# Turns off buffering for easier container logging
ENV PYTHONUNBUFFERED=1
# Set the working directory in the container
WORKDIR /code
# Install Poetry
# Note: Consider locking the Poetry version for consistent builds
ENV POETRY_VERSION=1.7
RUN pip install "poetry==$POETRY_VERSION" --no-cache-dir
# Copy the project files into the working directory
COPY pyproject.toml poetry.lock* /code/
# Configure Poetry
# - Do not create a virtual environment inside the Docker container
# - Do not ask any interactive question (like the confirmation of package installation)
ENV POETRY_VIRTUALENVS_CREATE=false
ENV POETRY_NO_INTERACTION=1
# Install runtime dependencies using Poetry
RUN poetry install --no-dev --no-root
# Copy the rest of the project files into the working directory
COPY . /code/
HEALTHCHECK CMD curl --fail http://localhost:8000/ || exit 1
# Use a script as the entrypoint
ENTRYPOINT ["/code/entrypoint.sh"]