Spaces:
Sleeping
Sleeping
Create Dockerfile
Browse files- Dockerfile +36 -0
Dockerfile
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Start with a lightweight Linux Anaconda image
|
| 2 |
+
FROM continuumio/miniconda3
|
| 3 |
+
|
| 4 |
+
# Update all packages and install nano unzip and curl
|
| 5 |
+
RUN apt-get update
|
| 6 |
+
RUN apt-get install nano unzip curl -y
|
| 7 |
+
|
| 8 |
+
# THIS IS SPECIFIC TO HUGGINFACE
|
| 9 |
+
# We create a new user named "user" with ID of 1000
|
| 10 |
+
RUN useradd -m -u 1000 user
|
| 11 |
+
# We switch from "root" (default user when creating an image) to "user"
|
| 12 |
+
USER user
|
| 13 |
+
# We set two environment variables
|
| 14 |
+
# so that we can give ownership to all files in there afterwards
|
| 15 |
+
# we also add /home/user/.local/bin in the $PATH environment variable
|
| 16 |
+
# PATH environment variable sets paths to look for installed binaries
|
| 17 |
+
# We update it so that Linux knows where to look for binaries if we were to install them with "user".
|
| 18 |
+
ENV HOME=/home/user \
|
| 19 |
+
PATH=/home/user/.local/bin:$PATH
|
| 20 |
+
|
| 21 |
+
# We set working directory to $HOME/app (<=> /home/user/app)
|
| 22 |
+
WORKDIR $HOME/app
|
| 23 |
+
|
| 24 |
+
# Install basic dependencies
|
| 25 |
+
RUN pip install boto3 pandas gunicorn streamlit scikit-learn matplotlib seaborn plotly
|
| 26 |
+
|
| 27 |
+
# Copy all local files to /home/user/app with "user" as owner of these files
|
| 28 |
+
# Always use --chown=user when using HUGGINGFACE to avoid permission errors
|
| 29 |
+
COPY --chown=user . $HOME/app
|
| 30 |
+
|
| 31 |
+
# THIS IS SPECIFIC TO HUGGINGFACE AS WELL
|
| 32 |
+
# expose port 7860 which is the port used by HuggingFace for Web Applications
|
| 33 |
+
EXPOSE 7860
|
| 34 |
+
|
| 35 |
+
# Run streamlit server
|
| 36 |
+
CMD streamlit run --server.port 7860 app.py
|