Skip to content

Commit 50babe6

Browse files
committed
Created requirements.txt using uv and reused former main.yml and dockefiles
1 parent e46d22a commit 50babe6

File tree

4 files changed

+153
-72
lines changed

4 files changed

+153
-72
lines changed

.github/workflows/main.yml

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1+
12
name: CI/CD Pipeline
23

34
on:
45
push:
56
branches:
67
- main
7-
- feature/uv-ci-test
88

99
jobs:
1010
build-and-push:
@@ -21,24 +21,16 @@ jobs:
2121
with:
2222
python-version: '3.12'
2323

24-
- name: Install uv
25-
run: pip install uv
26-
27-
- name: Generate requirements.txt
28-
run: uv pip compile pyproject.toml -o requirements.txt
29-
30-
- name: Create uv virtual environment
31-
run: uv venv
32-
3324
- name: Install Python dependencies for model training
3425
run: |
35-
uv pip install -r requirements.txt
26+
pip install --upgrade pip
27+
pip install -r requirements.txt
3628
3729
- name: Create models directory
3830
run: mkdir -p models
3931

4032
- name: Train the model
41-
run: uv run python -m src.model.model_training
33+
run: python -m src.model.model_training
4234

4335
- name: Set up Docker Buildx
4436
uses: docker/setup-buildx-action@v3

config/Dockerfile.api

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,14 @@
1-
# 1. Use a "builder" stage to install dependencies
2-
FROM python:3.12-slim AS builder
3-
4-
# Copy the uv binary from the official distroless image
5-
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
6-
7-
WORKDIR /app
8-
9-
# Create a virtual environment
10-
RUN uv venv
11-
12-
# Copy dependency definitions
13-
COPY pyproject.toml uv.lock ./
14-
15-
# Install dependencies into the virtual environment, excluding the project itself.
16-
RUN . .venv/bin/activate && uv sync --locked --no-install-project
17-
18-
# Copy the application source code
19-
COPY src/ ./src/
20-
21-
# Install the project itself into the venv.
22-
# Since dependencies are already installed, this step is very fast.
23-
RUN . .venv/bin/activate && uv pip install .
24-
25-
# 2. Use a clean "final" stage for the runtime environment
261
FROM python:3.12-slim
272

283
WORKDIR /app
294

30-
# Copy the virtual environment with all dependencies from the builder stage
31-
COPY --from=builder /app/.venv ./.venv
5+
COPY requirements.txt .
6+
RUN pip install --no-cache-dir -r requirements.txt
327

33-
# Copy other necessary assets
8+
COPY src/ ./src/
349
COPY models/model.joblib ./models/
3510
COPY data/data.csv ./data/
3611

37-
# Activate the virtual environment by adding it to the PATH
38-
ENV PATH="/app/.venv/bin:$PATH"
39-
4012
EXPOSE 5000
4113

42-
CMD ["python", "-m", "gunicorn", "--bind", "0.0.0.0:5000", "src.app:app"]
14+
CMD ["gunicorn", "--bind", "0.0.0.0:5000", "src.app:app"]

config/Dockerfile.streamlit

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,13 @@
1-
# 1. Use a "builder" stage to install dependencies
2-
FROM python:3.12-slim AS builder
3-
4-
# Copy the uv binary from the official distroless image
5-
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
1+
FROM python:3.12-slim
62

73
WORKDIR /app
84

9-
# Create a virtual environment
10-
RUN uv venv
11-
12-
# Copy dependency definitions
13-
COPY pyproject.toml uv.lock ./
5+
COPY requirements.txt .
146

15-
# Install dependencies into the virtual environment, excluding the project itself.
16-
RUN . .venv/bin/activate && uv sync --locked --no-install-project
7+
RUN pip install --no-cache-dir -r requirements.txt
178

18-
# Copy the application source code
199
COPY src/ ./src/
2010

21-
# Install the project itself into the venv.
22-
# Since dependencies are already installed, this step is very fast.
23-
RUN . .venv/bin/activate && uv pip install .
24-
25-
# 2. Use a clean "final" stage for the runtime environment
26-
FROM python:3.12-slim
27-
28-
WORKDIR /app
29-
30-
# Copy the virtual environment with all dependencies from the builder stage
31-
COPY --from=builder /app/.venv ./.venv
32-
33-
# Activate the virtual environment by adding it to the PATH
34-
ENV PATH="/app/.venv/bin:$PATH"
35-
3611
EXPOSE 8501
3712

3813
CMD ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]

requirements.txt

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
# This file was autogenerated by uv via the following command:
2+
# uv pip compile pyproject.toml -o requirements.txt
3+
altair==5.5.0
4+
# via streamlit
5+
attrs==25.4.0
6+
# via
7+
# jsonschema
8+
# referencing
9+
blinker==1.9.0
10+
# via
11+
# flask
12+
# streamlit
13+
cachetools==6.2.1
14+
# via streamlit
15+
certifi==2025.10.5
16+
# via requests
17+
charset-normalizer==3.4.4
18+
# via requests
19+
click==8.3.0
20+
# via
21+
# flask
22+
# streamlit
23+
colorama==0.4.6
24+
# via
25+
# click
26+
# pytest
27+
flask==3.1.2
28+
# via breast-cancer-ops (pyproject.toml)
29+
gitdb==4.0.12
30+
# via gitpython
31+
gitpython==3.1.45
32+
# via streamlit
33+
gunicorn==23.0.0
34+
# via breast-cancer-ops (pyproject.toml)
35+
idna==3.11
36+
# via requests
37+
iniconfig==2.1.0
38+
# via pytest
39+
itsdangerous==2.2.0
40+
# via flask
41+
jinja2==3.1.6
42+
# via
43+
# altair
44+
# flask
45+
# pydeck
46+
joblib==1.5.2
47+
# via
48+
# breast-cancer-ops (pyproject.toml)
49+
# scikit-learn
50+
jsonschema==4.25.1
51+
# via altair
52+
jsonschema-specifications==2025.9.1
53+
# via jsonschema
54+
markupsafe==3.0.3
55+
# via
56+
# flask
57+
# jinja2
58+
# werkzeug
59+
narwhals==2.8.0
60+
# via altair
61+
numpy==2.3.4
62+
# via
63+
# pandas
64+
# pydeck
65+
# scikit-learn
66+
# scipy
67+
# streamlit
68+
packaging==25.0
69+
# via
70+
# altair
71+
# gunicorn
72+
# pytest
73+
# streamlit
74+
pandas==2.3.3
75+
# via
76+
# breast-cancer-ops (pyproject.toml)
77+
# streamlit
78+
pillow==11.3.0
79+
# via streamlit
80+
pluggy==1.6.0
81+
# via pytest
82+
protobuf==6.33.0
83+
# via streamlit
84+
pyarrow==21.0.0
85+
# via streamlit
86+
pydeck==0.9.1
87+
# via streamlit
88+
pygments==2.19.2
89+
# via pytest
90+
pytest==8.4.2
91+
# via
92+
# breast-cancer-ops (pyproject.toml)
93+
# pytest-mock
94+
pytest-mock==3.15.1
95+
# via breast-cancer-ops (pyproject.toml)
96+
python-dateutil==2.9.0.post0
97+
# via pandas
98+
pytz==2025.2
99+
# via pandas
100+
referencing==0.37.0
101+
# via
102+
# jsonschema
103+
# jsonschema-specifications
104+
requests==2.32.5
105+
# via
106+
# breast-cancer-ops (pyproject.toml)
107+
# streamlit
108+
rpds-py==0.27.1
109+
# via
110+
# jsonschema
111+
# referencing
112+
scikit-learn==1.7.2
113+
# via breast-cancer-ops (pyproject.toml)
114+
scipy==1.16.2
115+
# via scikit-learn
116+
six==1.17.0
117+
# via python-dateutil
118+
smmap==5.0.2
119+
# via gitdb
120+
streamlit==1.50.0
121+
# via breast-cancer-ops (pyproject.toml)
122+
tenacity==9.1.2
123+
# via streamlit
124+
threadpoolctl==3.6.0
125+
# via scikit-learn
126+
toml==0.10.2
127+
# via streamlit
128+
tornado==6.5.2
129+
# via streamlit
130+
typing-extensions==4.15.0
131+
# via
132+
# altair
133+
# referencing
134+
# streamlit
135+
tzdata==2025.2
136+
# via pandas
137+
urllib3==2.5.0
138+
# via requests
139+
watchdog==6.0.0
140+
# via streamlit
141+
werkzeug==3.1.3
142+
# via flask

0 commit comments

Comments
 (0)