Skip to content

Commit 9f8fb80

Browse files
committed
prod fixes
1 parent 71d6307 commit 9f8fb80

2 files changed

Lines changed: 6 additions & 10 deletions

File tree

scripts/Dockerfile.prod

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,17 @@ FROM python:3.10.12-slim-buster
44
# Set the working directory in the container
55
WORKDIR /app
66

7-
# Download and cache the pre-trained model(s)
8-
ENV HF_HUB_CACHE=/app/.cache/huggingface/hub
9-
RUN pip install transformers==4.47.0 torch==2.5.1
10-
RUN --mount=type=secret,id=HF_TOKEN \
11-
export HF_TOKEN=$(cat /run/secrets/HF_TOKEN) && \
12-
python -c "from transformers import AutoProcessor, AutoModelForCTC; model_id = 'KoelLabs/xlsr-english-01'; AutoProcessor.from_pretrained(model_id); AutoModelForCTC.from_pretrained(model_id)"
13-
147
# Copy the requirements file into the container
158
COPY requirements.txt requirements.txt
169

1710
# Install the required packages
18-
RUN pip install --no-cache-dir -r requirements.txt
11+
RUN pip install --no-cache-dir -r requirements.txt && python -c "import nltk; nltk.download('cmudict'); nltk.download('averaged_perceptron_tagger_eng')"
1912

2013
# Copy the application code into the container
21-
COPY . .
14+
COPY ./src ./src
15+
16+
# Set non-secret environment variables
17+
ENV HF_HUB_CACHE=/app/.cache/huggingface/hub
2218

2319
# Expose the port that the Flask app will run on
2420
EXPOSE 8080

scripts/Dockerfile.prod.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ LICENSE
1010
.github
1111

1212
tests
13-
scipts
13+
scripts
1414

1515
.pytest_cache
1616
__pycache__

0 commit comments

Comments
 (0)