Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +21 -36
Dockerfile
CHANGED
@@ -1,44 +1,29 @@
|
|
1 |
-
# Use the official Python
|
2 |
-
FROM python:3.
|
3 |
|
4 |
-
#
|
5 |
-
|
6 |
|
7 |
-
#
|
8 |
-
|
9 |
-
|
|
|
10 |
|
11 |
-
# Install
|
12 |
-
|
13 |
-
RUN apt-get update && apt-get install -y \
|
14 |
-
build-essential \
|
15 |
-
curl \
|
16 |
-
software-properties-common \
|
17 |
-
libatlas-base-dev \
|
18 |
-
liblapack-dev \
|
19 |
-
libblas-dev \
|
20 |
-
&& rm -rf /var/lib/apt/lists/*
|
21 |
|
22 |
-
#
|
|
|
|
|
23 |
USER user
|
|
|
|
|
|
|
24 |
|
25 |
-
#
|
26 |
-
|
27 |
-
|
28 |
-
# Install Poetry via pip
|
29 |
-
RUN pip install --upgrade pip && pip install poetry
|
30 |
-
|
31 |
-
# Install dependencies without installing the project root package itself
|
32 |
-
RUN poetry install --no-root --only=main
|
33 |
-
|
34 |
-
# Expose the necessary port
|
35 |
-
EXPOSE 7860
|
36 |
-
|
37 |
-
# Copy the rest of your application code to the container
|
38 |
-
COPY --chown=user:user . /app/
|
39 |
|
40 |
-
#
|
41 |
-
|
42 |
|
43 |
-
|
44 |
-
CMD ["poetry", "run", "streamlit", "run", "presidio_streamlit.py", "--server.port=7860", "--server.address=0.0.0.0"]
|
|
|
1 |
+
# Use the official Python 3.9 image
|
2 |
+
FROM python:3.9
|
3 |
|
4 |
+
# Set the working directory to /code
|
5 |
+
WORKDIR /code
|
6 |
|
7 |
+
# Copy the current directory contents into the container at /code
|
8 |
+
COPY ./pyproject.toml /code/pyproject.toml
|
9 |
+
COPY ./poetry.lock /code/poetry.lock
|
10 |
+
COPY ./index.md /code/index.md
|
11 |
|
12 |
+
# Install requirements.txt
|
13 |
+
RUN pip install poetry && poetry install --only=main
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
+
# Set up a new user named "user" with user ID 1000
|
16 |
+
RUN useradd -m -u 1000 user
|
17 |
+
# Switch to the "user" user
|
18 |
USER user
|
19 |
+
# Set home to the user's home directory
|
20 |
+
ENV HOME=/home/user \
|
21 |
+
PATH=/home/user/.local/bin:$PATH
|
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 ["poetry", "run", "streamlit", "run", "presidio_streamlit.py", "--server.port=7860", "--server.address=0.0.0.0"]
|
|