keshavbhandari
commited on
Commit
•
e105841
1
Parent(s):
f89ac00
Trying with docker
Browse files- Dockerfile +29 -0
- run.sh +13 -0
- setup.txt +0 -19
Dockerfile
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM continuumio/anaconda3:main
|
2 |
+
|
3 |
+
WORKDIR /code
|
4 |
+
COPY ./environment.yml /code/environment.yml
|
5 |
+
|
6 |
+
# Create the environment using the environment.yml file
|
7 |
+
# RUN conda env create -f /code/environment.yml
|
8 |
+
|
9 |
+
# Set up a new user named "user" with user ID 1000
|
10 |
+
RUN useradd -m -u 1000 user
|
11 |
+
# Switch to the "user" user
|
12 |
+
USER user
|
13 |
+
# Set home to the user's home directory
|
14 |
+
ENV HOME=/home/user \
|
15 |
+
PYTHONPATH=$HOME/app \
|
16 |
+
PYTHONUNBUFFERED=1 \
|
17 |
+
GRADIO_ALLOW_FLAGGING=never \
|
18 |
+
GRADIO_NUM_PORTS=1 \
|
19 |
+
GRADIO_SERVER_NAME=0.0.0.0 \
|
20 |
+
GRADIO_THEME=huggingface \
|
21 |
+
SYSTEM=spaces
|
22 |
+
|
23 |
+
# Set the working directory to the user's home directory
|
24 |
+
WORKDIR $HOME/app
|
25 |
+
|
26 |
+
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
27 |
+
COPY --chown=user . $HOME/app
|
28 |
+
|
29 |
+
CMD ["./run.sh"]
|
run.sh
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
CONDA_ENV=$(head -1 /code/environment.yml | cut -d" " -f2)
|
3 |
+
eval "$(conda shell.bash hook)"
|
4 |
+
conda activate $CONDA_ENV
|
5 |
+
|
6 |
+
# Install fluidsynth using conda
|
7 |
+
conda install -c conda-forge fluidsynth -y
|
8 |
+
|
9 |
+
# Install pip packages
|
10 |
+
pip install -r requirements.txt
|
11 |
+
|
12 |
+
# Run the app
|
13 |
+
python app.py
|
setup.txt
DELETED
@@ -1,19 +0,0 @@
|
|
1 |
-
import os
|
2 |
-
import subprocess
|
3 |
-
import sys
|
4 |
-
|
5 |
-
requirement_path = "requirements.txt"
|
6 |
-
install_requires = []
|
7 |
-
if os.path.isfile(requirement_path):
|
8 |
-
with open(requirement_path) as f:
|
9 |
-
install_requires = f.read().splitlines()
|
10 |
-
setup(name="mypackage", install_requires=install_requires, [...])
|
11 |
-
|
12 |
-
def install_fluidsynth():
|
13 |
-
try:
|
14 |
-
subprocess.check_call([
|
15 |
-
'conda', 'install', '-c', 'conda-forge', 'fluidsynth', '-y'
|
16 |
-
])
|
17 |
-
except subprocess.CalledProcessError as e:
|
18 |
-
sys.exit(e.returncode)
|
19 |
-
install_fluidsynth()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|