File size: 1,808 Bytes
88c0b9b
 
d2149ab
 
 
ab33fca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1854c48
88c0b9b
 
 
 
 
 
 
 
fd84e26
 
 
 
 
 
88c0b9b
 
 
 
 
 
 
fd84e26
88c0b9b
 
 
 
 
 
 
 
1e9b2c6
 
 
 
 
 
 
 
 
88c0b9b
 
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
FROM python:3.11

FROM nvidia/cuda:11.7.1-cudnn8-devel-ubuntu22.04
ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && \
    apt-get upgrade -y && \
    apt-get install -y --no-install-recommends \
    git \
    git-lfs \
    wget \
    curl \
    # python build dependencies \
    build-essential \
    libssl-dev \
    zlib1g-dev \
    libbz2-dev \
    libreadline-dev \
    libsqlite3-dev \
    libncursesw5-dev \
    xz-utils \
    tk-dev \
    libxml2-dev \
    libxmlsec1-dev \
    libffi-dev \
    liblzma-dev \
    # gradio dependencies \
    ffmpeg \
    # fairseq2 dependencies \
    libsndfile-dev && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*


# Install miniconda
RUN apt-get install -y wget && rm -rf /var/lib/apt/lists/*

RUN wget \
	https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \
	&& bash Miniconda3-latest-Linux-x86_64.sh -b -p /opt/miniconda3 \
	&& rm -f Miniconda3-latest-Linux-x86_64.sh

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

# Switch to the "user" user
USER user

# Add conda binary to PATH variable
ENV HOME=/home/user \
	PATH=/opt/miniconda3/bin:/home/user/.local/bin:$PATH \
	CONDA_PREFIX=/opt/miniconda3/envs

# Setup conda envs
WORKDIR $HOME/app
COPY --chown=user . $HOME/app

# Conda envs setup 
RUN bash ./scripts/EnvsSetup.sh

# pre-download all models
RUN conda run --live-stream -n WavJourney python scripts/download_models.py
RUN mkdir $HOME/app/services_logs

# Env settings to get docker images to work on HF Spaces
ENV PYTHONPATH=${HOME}/app \
    PYTHONUNBUFFERED=1 \
    GRADIO_ALLOW_FLAGGING=never \
    GRADIO_NUM_PORTS=1 \
    GRADIO_SERVER_NAME=0.0.0.0 \
    GRADIO_THEME=huggingface \
    SYSTEM=spaces

# entrypoint
ENTRYPOINT bash /home/user/app/scripts/start_service_and_ui.sh