Skip to content

Commit 2295cda

Browse files
committed
Updated Docker & .dockerignore for deployment in Railway
1 parent a882ffa commit 2295cda

2 files changed

Lines changed: 57 additions & 22 deletions

File tree

.dockerignore

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,50 @@
1-
__pycache__
1+
# Ignore Python cache files
2+
__pycache__/
23
*.pyc
34
*.pyo
45
*.pyd
6+
7+
# Ignore virtual environments
58
env/
6-
venv/
9+
10+
# Ignore logs and raw data
711
logs/
812
data/
13+
14+
# Ignore macOS system files
915
.DS_Store
16+
17+
# Ignore notebooks (dev use only)
18+
notebooks/
1019
*.ipynb
20+
21+
# Ignore all models except the best one
22+
models/*
23+
!models/ensemble_voting_model.pkl
24+
!models/tfidf_vectorizer.pkl
25+
26+
27+
# Ignore test files
28+
tests/
29+
30+
# Ignore coverage and other test outputs
31+
.coverage
32+
pytest_cache/
33+
htmlcov/
34+
*.log
35+
36+
# Ignore Jupyter-related config
37+
.ipynb_checkpoints/
38+
39+
# Ignore deployment configs not needed in container
40+
render.yaml
41+
README.md
42+
folder_structure.txt
43+
LICENSE
44+
45+
# General
46+
.git
47+
.github
48+
.vscode/
49+
.idea/
50+

Dockerfile

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,32 @@
1-
# ───────────────────────────────────────────────────────────────
2-
# Dockerfile for Fake-News-Detector – FastAPI + ML model
3-
# ───────────────────────────────────────────────────────────────
4-
51
# 1. Base image
62
FROM python:3.11-slim
73

84
# 2. Working directory
95
WORKDIR /app
106

11-
# 3. System packages required for building wheels (e.g. wordcloud)
7+
# 3. Install system dependencies
128
RUN apt-get update && apt-get install -y --no-install-recommends \
13-
build-essential \
14-
libpng-dev \
15-
libjpeg-dev \
16-
libfreetype6-dev \
17-
pkg-config \
18-
&& rm -rf /var/lib/apt/lists/*
19-
20-
# 4. Copy requirements first (leverages Docker layer cache)
9+
build-essential \
10+
libjpeg-dev \
11+
libpng-dev \
12+
libfreetype6-dev \
13+
pkg-config \
14+
&& apt-get clean \
15+
&& rm -rf /var/lib/apt/lists/*
16+
17+
# 4. Install Python dependencies
2118
COPY requirements.txt .
22-
23-
# 5. Install Python deps
2419
RUN pip install --upgrade pip \
25-
&& pip install --default-timeout=100 --no-cache-dir -r requirements.txt
20+
&& pip install --no-cache-dir -r requirements.txt
2621

27-
# 6. Copy the rest of the project
22+
# 5. Copy project files
2823
COPY . .
2924

30-
# 7. Environment
25+
# 6. Set environment variables
3126
ENV PYTHONUNBUFFERED=1
3227

33-
# 8. Expose FastAPI port
28+
# 7. Expose port
3429
EXPOSE 8000
3530

36-
# 9. Launch the app
31+
# 8. Run app
3732
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]

0 commit comments

Comments
 (0)