Skip to content

Commit c0d5749

Browse files
committed
🔒 fix: add .dockerignore to keep .env and .venv out of image layers
Both Dockerfiles COPY . . and Docker does not read .gitignore, so a developer building with a real .env present would bake HUGGINGFACE_HUB_TOKEN and API_KEY into an image layer permanently (a later rm does not remove layer contents). docker-compose.yml already bind-mounts ./.env:/app/.env:ro at runtime, so the build never needs it. Also excludes .venv (~1 GB locally) and generated transcript artifacts; build context drops from ~1 GB to ~41 kB. *.txt is excluded with a !requirements.txt negation because both Dockerfiles COPY requirements.txt before the main COPY. Also: pin Python 3.13 via .python-version, update README prerequisites, and document in the CUDA Dockerfile why the ubuntu22.04 base is correct (Python 3.13 already comes from deadsnakes, not the system 3.10). Verified with a dummy .env and a populated 981 MB .venv in the context: probe image with the same COPY directives shows .env and .venv absent, requirements.txt and all app files present.
1 parent 554047d commit c0d5749

4 files changed

Lines changed: 52 additions & 1 deletion

File tree

.dockerignore

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Docker does not read .gitignore, so this file has to repeat it.
2+
# Both Dockerfiles do `COPY . .`, so anything not excluded here is baked
3+
# into an image layer permanently -- a later `rm` does NOT remove it.
4+
5+
# Secrets. docker-compose.yml bind-mounts ./.env:/app/.env:ro at runtime,
6+
# so the build never needs it. .env.example is kept (pattern is exact).
7+
.env
8+
9+
# Local virtualenv. ~1 GB once torch/whisperx are installed, and it would
10+
# shadow the container's own site-packages.
11+
.venv
12+
13+
# VCS
14+
.git
15+
.gitignore
16+
.dockerignore
17+
18+
# Python build artifacts
19+
__pycache__/
20+
*.py[cod]
21+
22+
# Input/output working dirs. Both Dockerfiles `RUN mkdir -p input output`,
23+
# so excluding the contents here is safe.
24+
input/*
25+
output/*
26+
27+
# Generated transcript/summary artifacts (mirrors .gitignore)
28+
*.json
29+
*.tsv
30+
*.vtt
31+
*.srt
32+
*.pdf
33+
*.zip
34+
*.wav
35+
*.m4a
36+
recording.txt
37+
executive_summary.md
38+
39+
# *.txt is excluded for transcripts, but requirements.txt must stay copyable:
40+
# both Dockerfiles do `COPY requirements.txt .` before the main COPY.
41+
*.txt
42+
!requirements.txt

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.13

Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
# Secure Speech-to-Text - GPU Dockerfile (CUDA 12.8 + cuDNN)
2+
#
3+
# Python target: 3.13 (matches .python-version and Dockerfile.cpu).
4+
#
5+
# This base is ubuntu22.04, whose *system* Python is 3.10. We do not use it --
6+
# 3.13 comes from the deadsnakes PPA below and is made the default via
7+
# update-alternatives. Don't "simplify" this by switching to the ubuntu24.04
8+
# base: it ships Python 3.12, which is further from the 3.13 standard, not
9+
# closer. WhisperX requires >=3.10,<3.14, so 3.13 is the newest usable minor.
210
FROM nvidia/cuda:12.8.0-cudnn-runtime-ubuntu22.04
311

412
# Prevent interactive prompts during package installation

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ python secure_speech_to_text.py meeting.m4a --output-dir ./my-transcripts
112112

113113
### Prerequisites
114114

115-
- **Python 3.9 to 3.13** (3.14+ not supported by WhisperX)
115+
- **Python 3.13** (see `.python-version`). WhisperX requires `>=3.10,<3.14`, so 3.13 is the newest usable minor.
116116
- FFmpeg installed and on PATH
117117
- A local LLM server for executive summaries (optional)
118118

0 commit comments

Comments
 (0)