Spaces:
Running
Running
Upload 3 files
Browse files- Dockerfile +15 -5
- poetry.lock +15 -1
Dockerfile
CHANGED
@@ -1,5 +1,7 @@
|
|
|
|
1 |
FROM python:3.10-slim
|
2 |
|
|
|
3 |
RUN apt-get update && apt-get install -y \
|
4 |
build-essential \
|
5 |
curl \
|
@@ -9,31 +11,39 @@ RUN apt-get update && apt-get install -y \
|
|
9 |
libblas-dev \
|
10 |
&& rm -rf /var/lib/apt/lists/*
|
11 |
|
|
|
12 |
WORKDIR /code
|
13 |
|
14 |
-
|
15 |
-
# Poetry
|
16 |
RUN pip install --upgrade pip \
|
17 |
&& pip install poetry
|
18 |
|
|
|
19 |
COPY pyproject.toml poetry.lock /code/
|
20 |
|
21 |
-
|
22 |
-
|
23 |
|
|
|
24 |
EXPOSE 7860
|
25 |
|
|
|
26 |
COPY . /code
|
27 |
|
|
|
28 |
RUN useradd -m -u 1000 user
|
29 |
USER user
|
30 |
ENV HOME=/home/user \
|
31 |
-
|
32 |
|
|
|
33 |
WORKDIR $HOME/app
|
34 |
|
|
|
35 |
COPY --chown=user . $HOME/app
|
36 |
|
|
|
37 |
HEALTHCHECK CMD curl --fail http://localhost:7860/_stcore/health
|
38 |
|
|
|
39 |
CMD ["poetry", "run", "python", "-m", "streamlit", "run", "presidio_streamlit.py", "--server.port=7860", "--server.address=0.0.0.0"]
|
|
|
1 |
+
# Use the official Python slim image
|
2 |
FROM python:3.10-slim
|
3 |
|
4 |
+
# Install system dependencies needed for building Python packages
|
5 |
RUN apt-get update && apt-get install -y \
|
6 |
build-essential \
|
7 |
curl \
|
|
|
11 |
libblas-dev \
|
12 |
&& rm -rf /var/lib/apt/lists/*
|
13 |
|
14 |
+
# Set the working directory in the container
|
15 |
WORKDIR /code
|
16 |
|
17 |
+
# Install Poetry via pip
|
|
|
18 |
RUN pip install --upgrade pip \
|
19 |
&& pip install poetry
|
20 |
|
21 |
+
# Copy the pyproject.toml and poetry.lock files
|
22 |
COPY pyproject.toml poetry.lock /code/
|
23 |
|
24 |
+
# Install project dependencies
|
25 |
+
RUN poetry install --only main
|
26 |
|
27 |
+
# Expose the necessary port
|
28 |
EXPOSE 7860
|
29 |
|
30 |
+
# Copy the rest of your application code
|
31 |
COPY . /code
|
32 |
|
33 |
+
# Create a user and switch to it
|
34 |
RUN useradd -m -u 1000 user
|
35 |
USER user
|
36 |
ENV HOME=/home/user \
|
37 |
+
PATH=/home/user/.local/bin:$PATH
|
38 |
|
39 |
+
# Set the working directory for the user
|
40 |
WORKDIR $HOME/app
|
41 |
|
42 |
+
# Copy application code to the user's home directory
|
43 |
COPY --chown=user . $HOME/app
|
44 |
|
45 |
+
# Add health check for the application
|
46 |
HEALTHCHECK CMD curl --fail http://localhost:7860/_stcore/health
|
47 |
|
48 |
+
# Command to run your application
|
49 |
CMD ["poetry", "run", "python", "-m", "streamlit", "run", "presidio_streamlit.py", "--server.port=7860", "--server.address=0.0.0.0"]
|
poetry.lock
CHANGED
@@ -692,6 +692,20 @@ files = [
|
|
692 |
[package.extras]
|
693 |
dev = ["coverage", "pytest (>=7.4.4)"]
|
694 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
695 |
[[package]]
|
696 |
name = "exceptiongroup"
|
697 |
version = "1.2.2"
|
@@ -4643,4 +4657,4 @@ files = [
|
|
4643 |
[metadata]
|
4644 |
lock-version = "2.0"
|
4645 |
python-versions = "^3.10"
|
4646 |
-
content-hash = "
|
|
|
692 |
[package.extras]
|
693 |
dev = ["coverage", "pytest (>=7.4.4)"]
|
694 |
|
695 |
+
[[package]]
|
696 |
+
name = "en_core_web_lg"
|
697 |
+
version = "3.8.0"
|
698 |
+
description = "English pipeline optimized for CPU. Components: tok2vec, tagger, parser, senter, ner, attribute_ruler, lemmatizer."
|
699 |
+
optional = false
|
700 |
+
python-versions = "*"
|
701 |
+
files = [
|
702 |
+
{file = "en_core_web_lg-3.8.0.tar.gz", hash = "sha256:7a3c89f3243950000a102c5f124277bbbde2dec467d548eee28b23bd1938ed62"},
|
703 |
+
]
|
704 |
+
|
705 |
+
[package.source]
|
706 |
+
type = "url"
|
707 |
+
url = "https://github.com/explosion/spacy-models/releases/download/en_core_web_lg-3.8.0/en_core_web_lg-3.8.0.tar.gz"
|
708 |
+
|
709 |
[[package]]
|
710 |
name = "exceptiongroup"
|
711 |
version = "1.2.2"
|
|
|
4657 |
[metadata]
|
4658 |
lock-version = "2.0"
|
4659 |
python-versions = "^3.10"
|
4660 |
+
content-hash = "f9a8eae4b0dddfadd3767edc514492a718c2cb96de0b327aa9860f89d65e2b88"
|