licorne2lc commited on
Commit
4686dc7
·
1 Parent(s): b478d9c

Add application file

Browse files
Files changed (3) hide show
  1. Dockerfile +35 -0
  2. app.py +11 -0
  3. requirements.txt +11 -0
Dockerfile ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM continuumio/miniconda3
2
+
3
+ RUN apt-get update -y
4
+ RUN apt-get install nano unzip curl -y
5
+
6
+ # THIS IS SPECIFIC TO HUGGINFACE
7
+ # We create a new user named "user" with ID of 1000
8
+ RUN useradd -m -u 1000 user
9
+ # We switch from "root" (default user when creating an image) to "user"
10
+ USER user
11
+ # We set two environmnet variables
12
+ # so that we can give ownership to all files in there afterwards
13
+ # we also add /home/user/.local/bin in the $PATH environment variable
14
+ # PATH environment variable sets paths to look for installed binaries
15
+ # We update it so that Linux knows where to look for binaries if we were to install them with "user".
16
+ ENV HOME=/home/user \
17
+ PATH=/home/user/.local/bin:$PATH
18
+
19
+ # We set working directory to $HOME/app (<=> /home/user/app)
20
+ WORKDIR $HOME/app
21
+
22
+ # Install basic dependencies
23
+ RUN pip install boto3 pandas gunicorn streamlit scikit-learn matplotlib seaborn plotly
24
+
25
+ # Copy all local files to /home/user/app with "user" as owner of these files
26
+ # Always use --chown=user when using HUGGINGFACE to avoid permission errors
27
+ COPY --chown=user . $HOME/app
28
+
29
+ COPY requirements.txt /dependencies/requirements.txt
30
+ RUN pip install -r /dependencies/requirements.txt
31
+
32
+ COPY . $HOME/app
33
+
34
+ CMD fastapi run app.py --port $PORT
35
+ # CMD gunicorn app:app --bind 0.0.0.0:$PORT --worker-class uvicorn.workers.UvicornWorker
app.py ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import uvicorn
2
+ from fastapi import FastAPI
3
+
4
+ app = FastAPI()
5
+
6
+ @app.get("/")
7
+ async def index():
8
+
9
+ message = "Hello world! This `/` is the most simple and default endpoint. If you want to learn more, check out documentation of the api at `/docs`"
10
+
11
+ return message
requirements.txt ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ fastapi[standard]
2
+ pydantic
3
+ typing
4
+ pandas
5
+ openpyxl
6
+ mlflow
7
+ boto3
8
+ scikit-learn
9
+ python-multipart
10
+ fsspec
11
+ s3fs