18 lines
602 B
Docker
18 lines
602 B
Docker
FROM python:3.10
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy source code only (not local venv due to .dockerignore)
|
|
COPY . .
|
|
|
|
# Create fresh venv and install dependencies
|
|
RUN echo "[🛠️ BUILD TIME] Creating venv..." && \
|
|
python -m venv myenv && \
|
|
./myenv/bin/pip install --upgrade pip && \
|
|
if [ -f requirements.txt ]; then ./myenv/bin/pip install -r requirements.txt; fi && \
|
|
echo "[✅ BUILD TIME] Python version:" && \
|
|
./myenv/bin/python --version
|
|
|
|
# Run-time: use the venv
|
|
CMD ["/bin/bash", "-c", "echo '[🚀 CONTAINER TIME] Running in venv...' && source myenv/bin/activate && python --version"]
|