Spaces:
Sleeping
Sleeping
update docker file
Browse files- Dockerfile +12 -13
- app.py +1 -1
Dockerfile
CHANGED
@@ -1,29 +1,28 @@
|
|
1 |
FROM python:3.10.12
|
2 |
|
|
|
|
|
|
|
3 |
RUN useradd -m -u 1000 user
|
4 |
|
|
|
5 |
WORKDIR /app
|
6 |
COPY ./packages.txt /app/packages.txt
|
7 |
RUN apt-get update && xargs -r -a packages.txt apt-get install -y && rm -rf /var/lib/apt/lists/*
|
8 |
|
9 |
-
#
|
10 |
-
|
11 |
-
#USER user
|
12 |
-
#ENV HOME=/home/user \
|
13 |
-
# PATH=/home/user/.local/bin:$PATH
|
14 |
-
|
15 |
-
# setting workdir
|
16 |
-
# WORKDIR $HOME/app
|
17 |
-
|
18 |
COPY --chown=user ./requirements.txt requirements.txt
|
19 |
-
#COPY --chown=user ./packages.txt packages.txt
|
20 |
-
|
21 |
RUN pip3 install --no-cache-dir -r requirements.txt
|
22 |
-
#RUN apt-get update && xargs -r -a packages.txt apt-get install -y && rm -rf /var/lib/apt/lists/*
|
23 |
|
|
|
|
|
24 |
|
25 |
-
COPY --chown=
|
26 |
|
|
|
|
|
|
|
|
|
27 |
EXPOSE 8501
|
28 |
CMD streamlit run app.py \
|
29 |
--server.headless true \
|
|
|
1 |
FROM python:3.10.12
|
2 |
|
3 |
+
# always create the user first and add
|
4 |
+
# to avoid the permission issue when editing the files later especially
|
5 |
+
# if you want to use the dev mode
|
6 |
RUN useradd -m -u 1000 user
|
7 |
|
8 |
+
# define the directory and install packages
|
9 |
WORKDIR /app
|
10 |
COPY ./packages.txt /app/packages.txt
|
11 |
RUN apt-get update && xargs -r -a packages.txt apt-get install -y && rm -rf /var/lib/apt/lists/*
|
12 |
|
13 |
+
# copy the requirements to container and install them
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
COPY --chown=user ./requirements.txt requirements.txt
|
|
|
|
|
15 |
RUN pip3 install --no-cache-dir -r requirements.txt
|
|
|
16 |
|
17 |
+
# Copy the current directory contents into the container at /app setting the owner to the user
|
18 |
+
#COPY --chown=user . /app
|
19 |
|
20 |
+
COPY --link --chown=1000 ./ /app
|
21 |
|
22 |
+
# app will need to expose the port for taking browser inputs
|
23 |
+
# make sure to have same port as mentioned in Readme.md
|
24 |
+
# rest of the code is from https://huggingface.co/spaces/SpacesExamples/streamlit-docker-example/blob/main/Dockerfile
|
25 |
+
# sepcific for streamlit docker
|
26 |
EXPOSE 8501
|
27 |
CMD streamlit run app.py \
|
28 |
--server.headless true \
|
app.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
import streamlit as st
|
2 |
-
|
3 |
with st.sidebar:
|
4 |
# upload and example doc
|
5 |
choice = st.sidebar.radio(label = 'Select the Document',
|
|
|
1 |
import streamlit as st
|
2 |
+
|
3 |
with st.sidebar:
|
4 |
# upload and example doc
|
5 |
choice = st.sidebar.radio(label = 'Select the Document',
|