-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
48 lines (38 loc) · 1.38 KB
/
Dockerfile
File metadata and controls
48 lines (38 loc) · 1.38 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
# Use Ubuntu 24.04 as base, matching the GitHub Actions runner (ubuntu-latest is based on 22.04/24.04 variants)
FROM ubuntu:24.04
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV DEBIAN_FRONTEND=noninteractive
# Install system dependencies and Python 3.12
RUN apt-get update && apt-get install -y --no-install-recommends \
python3.12 \
python3.12-venv \
python3-pip \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Set Python 3.12 as default
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.12 1 \
&& update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 1
# Create a virtual environment to avoid externally managed environment issues
RUN python -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
# Upgrade pip and install wheel/setuptools in the venv
RUN python -m pip install --upgrade pip setuptools wheel
# Set working directory
WORKDIR /app
# Copy requirements.txt (if it exists) and install dependencies in the venv
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Install linting and testing tools in the venv
RUN pip install --no-cache-dir \
ruff \
flake8 \
pylint \
pytest \
pytest-cov \
yamllint
# Copy the rest of the code (including .pylintrc if present)
COPY . .
# Default command: bash shell for interactive use
CMD ["bash"]