21 lines
592 B
Docker
21 lines
592 B
Docker
# Use an official Python runtime as a parent image
|
|
FROM python:3.10
|
|
|
|
# Set the working directory inside the container
|
|
WORKDIR /app
|
|
|
|
# Ensure the directory exists
|
|
RUN mkdir -p /app
|
|
|
|
# Copy the requirements file before copying the app files (for better caching)
|
|
COPY requirements.txt .
|
|
COPY main.py .
|
|
COPY Loader.py .
|
|
|
|
# Create and activate a virtual environment
|
|
RUN python -m venv venv && \
|
|
. venv/bin/activate && \
|
|
pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Run the application using the virtual environment
|
|
CMD ["/bin/bash", "-c", "source venv/bin/activate && python main.py"] |