-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
31 lines (21 loc) · 773 Bytes
/
Dockerfile
File metadata and controls
31 lines (21 loc) · 773 Bytes
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
FROM python:3.12.3
# Set the working directory
WORKDIR /code
# Create the directory structure and an empty log file
RUN mkdir -p app/base/logs && touch app/base/logs/application.log
# Ensure the log file is writable
RUN chmod 666 app/base/logs/application.log
COPY ./pyproject.toml /code/
# Install Poetry
RUN pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir poetry
# Copy Poetry files to the container
COPY ./pyproject.toml ./poetry.lock* /code/
# Install dependencies using Poetry
RUN poetry config virtualenvs.create false \
&& poetry install --no-interaction --no-ansi
# Copy the entire project to the container
COPY ./ /code/
EXPOSE 8000
# Command to run the FastAPI app
CMD ["fastapi", "run", "app/main.py", "--port", "8000"]