File size: 661 Bytes
a2f903f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Use an official Python runtime as a parent image
FROM python:3.10-slim-bookworm

# Set the working directory in the container
WORKDIR /app

# Prevent python from writing pyc files to disc and buffer logs
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

# Copy only the requirements file to leverage Docker cache
# This is the layer that takes a long time, but it will be cached after the first build.
COPY requirements.txt .

# Install dependencies
# Using --no-cache-dir reduces image size
RUN pip install -r requirements.txt

# Command to run the application
# The CMD will run the app from the volume mounted by docker-compose
CMD ["python", "app.py"]