File size: 2,644 Bytes
6c99403
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d4b369d
 
a372da6
d4b369d
 
 
a372da6
 
d4b369d
13ad831
 
 
 
 
 
6c99403
 
 
 
 
 
a1e0367
 
 
 
 
 
6c99403
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
FROM docker.io/pytorch/pytorch:2.5.1-cuda12.1-cudnn9-runtime

WORKDIR /code

RUN apt-get update && \
    apt-get install -y git && \
    apt install -y default-jre

RUN git clone https://github.com/mumbert/dcase2024-task6-baseline-project.git && \
    cd dcase2024-task6-baseline-project

WORKDIR /code/dcase2024-task6-baseline-project

RUN pip install --force-reinstall pip==23.0 && \
    pip install -e . && \
    exit 0
RUN pip install matplotlib==3.10.1 seaborn==0.13.2 spacy==3.8.4  && \
    python -m spacy download en_core_web_sm && \
    exit 0
RUN pip install gradio==5.21.0 && \
    exit 0
# RUN python src/dcase24t6/test_installation.py
# RUN huggingface-hub==0.27.1

# RUN wget https://zenodo.org/records/10849427/files/epoch_192-step_001544-mode_min-val_loss_3.3758.ckpt?download=1 && \
#     wget https://zenodo.org/records/10849427/files/tokenizer.json?download=1    

#     pip install -e . --use-deprecated=legacy-resolver && \
#     pip install -e .[dev] --use-deprecated=legacy-resolver \
# COPY /home/mumbert/.cache/huggingface/stored_tokens /root/.cache/huggingface/stored_tokens
# RUN dcase24t6-prepare

# Set up a new user named "user" with user ID 1000
# RUN useradd -m -u 1000 user

# Switch to the "user" user
#USER user

# Set home to the user's home directory
#ENV HOME=/home/user \
#    PATH=/home/user/.local/bin:$PATH

# Set the working directory to the user's home directory
#WORKDIR $HOME/app

# RUN pip install gradio

# Copy the current directory contents into the container at $HOME/app setting the owner to the user
#COPY --chown=user . $HOME/app
WORKDIR /code/dcase2024-task6-baseline-project
COPY . .

ENV MPLCONFIGDIR=/var/cache/matplotlib
ENV TRANSFORMERS_CACHE=/var/cache/huggingface/hub
ENV NUMBA_CACHE_DIR=/tmp/NUMBA_CACHE_DIR/
RUN mkdir -p /var/cache/matplotlib && chmod -R 777 /var/cache/matplotlib && \
    mkdir -p /var/cache/huggingface/hub && chmod -R 777 /var/cache/huggingface/ && chmod -R 777 /var/cache/huggingface/hub && \
    mkdir /.config && chmod -R 777 /.config && \
    mkdir /nltk_data && chmod -R 777 /nltk_data && \
    mkdir -p /tmp/NUMBA_CACHE_DIR && chmod -R 777 /tmp/NUMBA_CACHE_DIR

RUN pip cache purge && \
    apt-get clean autoclean && \
    apt-get autoremove --yes && \
    rm -rf /var/lib/{apt,dpkg,cache,log}/
#    rm -rf /var/lib/apt/lists/*

RUN python -c 'import torch; from dcase24t6.nn.hub import baseline_pipeline; model = baseline_pipeline()'

ENV GRADIO_SERVER_PORT=7860
ENV GRADIO_SERVER_NAME="0.0.0.0"
EXPOSE 7860

# Set up a new user named "user" with user ID 1000
RUN useradd -m -u 1000 user

# Switch to the "user" user
USER user

CMD ["python", "app.py"]