Bushra-KB commited on
Commit
a4bb334
·
verified ·
1 Parent(s): d595d34

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -5
Dockerfile CHANGED
@@ -1,4 +1,13 @@
1
- FROM python:3.11-slim
 
 
 
 
 
 
 
 
 
2
 
3
  # Set environment variables for caching to a writable directory
4
  # These will be used by huggingface libraries to store models and other assets.
@@ -13,12 +22,12 @@ RUN mkdir -p $TRANSFORMERS_CACHE $HF_DATASETS_CACHE $TORCH_HOME && \
13
 
14
  # System deps for soundfile, audio encoding, and uroman
15
  RUN apt-get update && apt-get install -y --no-install-recommends \
16
- libsndfile1 ffmpeg git perl && \
17
  rm -rf /var/lib/apt/lists/*
18
 
19
- # Clone and install uroman from source so the tokenizer can find it
20
- RUN git clone https://github.com/isi-nlp/uroman.git /opt/uroman && \
21
- ln -s /opt/uroman/bin/uroman.pl /usr/local/bin/uroman
22
 
23
  WORKDIR /app
24
 
 
1
+ # Use a multi-stage build to handle uroman installation cleanly
2
+ # ---- Builder Stage for uroman ----
3
+ FROM python:3.10-slim as uroman-builder
4
+
5
+ # Install uroman via pip in a temporary stage
6
+ # This lets pip manage the download of the perl script
7
+ RUN pip install uroman==1.3.1.1
8
+
9
+ # ---- Final App Stage ----
10
+ FROM python:3.10-slim
11
 
12
  # Set environment variables for caching to a writable directory
13
  # These will be used by huggingface libraries to store models and other assets.
 
22
 
23
  # System deps for soundfile, audio encoding, and uroman
24
  RUN apt-get update && apt-get install -y --no-install-recommends \
25
+ libsndfile1 ffmpeg perl && \
26
  rm -rf /var/lib/apt/lists/*
27
 
28
+ # Copy the uroman script from the builder stage and create the symlink
29
+ COPY --from=uroman-builder /usr/local/lib/python3.10/site-packages/uroman/bin /opt/uroman
30
+ RUN ln -s /opt/uroman/uroman.pl /usr/local/bin/uroman
31
 
32
  WORKDIR /app
33