File size: 1,841 Bytes
2fbfe1c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
FROM docker.io/library/python:3.10@sha256:7118d485696a1eb1105ae30e3f55e5685117a9bc0c3ffbe3830a268911e0837d

# Install system dependencies
RUN apt-get update && apt-get install -y fakeroot && \
    mv /usr/bin/apt-get /usr/bin/.apt-get && \
    echo '#!/usr/bin/env sh\nfakeroot /usr/bin/.apt-get $@' > /usr/bin/apt-get && \
    chmod +x /usr/bin/apt-get && \
    rm -rf /var/lib/apt/lists/* && \
    useradd -m -u 1000 user

COPY --chown=1000:1000 --from=root / /

RUN pip install --no-cache-dir pip -U && \
    pip install --no-cache-dir \
    datasets \
    "huggingface-hub>=0.19" \
    "hf_xet>=1.0.0,<2.0.0" \
    "hf-transfer>=0.1.4" \
    "protobuf<4" \
    "click<8.1" \
    "pydantic~=1.0"

WORKDIR /home/user/app

RUN apt-get update && apt-get install -y \
    git git-lfs ffmpeg libsm6 libxext6 cmake rsync libgl1-mesa-glx && \
    rm -rf /var/lib/apt/lists/* && \
    git lfs install

RUN apt-get update && \
    apt-get install -y curl && \
    curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
    apt-get install -y nodejs && \
    rm -rf /var/lib/apt/lists/* && apt-get clean

# Assuming your requirements.txt is in the root of your repository
COPY requirements.txt /tmp/requirements.txt

# Install Python dependencies from requirements.txt
RUN pip install --no-cache-dir -r /tmp/requirements.txt

# Download the spaCy model and set the SPACY_DATA environment variable
RUN python -m spacy download en_core_web_sm
RUN python -c "import spacy; print(spacy.util.get_data_path())"
ENV SPACY_DATA=$(python -c "import spacy; print(spacy.util.get_data_path())")

# Copy your application code
COPY . /home/user/app

# Set the user context
USER user

# Define the command to run your application (adjust if your main file is named differently)
CMD ["python", "app.py"]