Spaces:
Sleeping
Sleeping
Alejadro Sanchez-Giraldo
commited on
Commit
·
d79de33
1
Parent(s):
abfb3b0
Add docker container
Browse files- README.md +20 -4
- dockerfile +20 -0
README.md
CHANGED
@@ -22,11 +22,19 @@ docker run -it -p 8501:8501 --platform=linux/amd64 \
|
|
22 |
-e LAUNCHDARKLY_SDK_KEY="<LAUNCHDARKLY_SDK_KEY>" \
|
23 |
registry.hf.space/asgface-sentimentai:latest streamlit run app.py
|
24 |
|
25 |
-
### API
|
26 |
|
27 |
-
|
28 |
-
|
29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
|
31 |
## Run locally
|
32 |
|
@@ -37,6 +45,14 @@ source myenv/bin/activate
|
|
37 |
|
38 |
LAUNCHDARKLY_SDK_KEY=<LAUNCHDARKLY_SDK_KEY> gunicorn -w 4 -b 0.0.0.0:5001 api:app
|
39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
### UI
|
41 |
|
42 |
python3 -m venv myenv
|
|
|
22 |
-e LAUNCHDARKLY_SDK_KEY="<LAUNCHDARKLY_SDK_KEY>" \
|
23 |
registry.hf.space/asgface-sentimentai:latest streamlit run app.py
|
24 |
|
25 |
+
### API - WIP
|
26 |
|
27 |
+
Build your Docker image
|
28 |
+
|
29 |
+
```bash
|
30 |
+
docker build -t myapi .
|
31 |
+
```
|
32 |
+
|
33 |
+
Run your Docker container, mapping port 5001 of the container to port 5001 on your host
|
34 |
+
|
35 |
+
```bash
|
36 |
+
docker run -p 5001:5001 -e LAUNCHDARKLY_SDK_KEY="<LAUNCHDARKLY_SDK_KEY>" myapi
|
37 |
+
```
|
38 |
|
39 |
## Run locally
|
40 |
|
|
|
45 |
|
46 |
LAUNCHDARKLY_SDK_KEY=<LAUNCHDARKLY_SDK_KEY> gunicorn -w 4 -b 0.0.0.0:5001 api:app
|
47 |
|
48 |
+
# Build your Docker image
|
49 |
+
|
50 |
+
docker build -t myapi .
|
51 |
+
|
52 |
+
# Run your Docker container, mapping port 5001 of the container to port 5001 on your host
|
53 |
+
|
54 |
+
docker run -p 5001:5001 myapi
|
55 |
+
|
56 |
### UI
|
57 |
|
58 |
python3 -m venv myenv
|
dockerfile
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Use an official Python runtime as a parent image
|
2 |
+
FROM python:3.8-slim
|
3 |
+
|
4 |
+
# Set the working directory in the container
|
5 |
+
WORKDIR /app
|
6 |
+
|
7 |
+
# Copy the current directory contents into the container at /app
|
8 |
+
COPY . /app
|
9 |
+
|
10 |
+
# Install any needed packages specified in requirements.txt
|
11 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
12 |
+
|
13 |
+
# Make port 5001 available to the world outside this container
|
14 |
+
EXPOSE 5001
|
15 |
+
|
16 |
+
# Define environment variable
|
17 |
+
ENV NAME World
|
18 |
+
|
19 |
+
# Run api.py when the container launches
|
20 |
+
CMD ["gunicorn", "-w", "4", "-b", "0.0.0.0:5001", "api:app"]
|