File size: 1,271 Bytes
1fa1dc2
8cd3e9e
60ad51d
1fa1dc2
60ad51d
 
 
 
343a392
 
 
 
60ad51d
1fa1dc2
60ad51d
 
1fa1dc2
00a618c
 
 
1fa1dc2
00a618c
 
1fa1dc2
 
547518c
1fa1dc2
60ad51d
 
1fa1dc2
60ad51d
 
1fa1dc2
c312584
 
 
1fa1dc2
c312584
1fa1dc2
c312584
 
1fa1dc2
c312584
 
1fa1dc2
60ad51d
 
1fa1dc2
00a618c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Use the official Python slim image
FROM python:3.10-slim

# Install system dependencies needed for building Python packages
RUN apt-get update && apt-get install -y \
    build-essential \
    curl \
    software-properties-common \
    libatlas-base-dev \
    liblapack-dev \
    libblas-dev \
    && rm -rf /var/lib/apt/lists/*

# Set the working directory in the container
WORKDIR /code

# Install Poetry via pip
RUN pip install --upgrade pip \
    && pip install poetry

# Copy the pyproject.toml and poetry.lock files
COPY pyproject.toml poetry.lock /code/

# Install project dependencies
RUN poetry install --only main

# Expose the necessary port
EXPOSE 7860

# Copy the rest of your application code
COPY . /code

# Create a user and switch to it
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH

# Set the working directory for the user
WORKDIR $HOME/app

# Copy application code to the user's home directory
COPY --chown=user . $HOME/app

# Add health check for the application
HEALTHCHECK CMD curl --fail http://localhost:7860/_stcore/health

# Command to run your application
CMD ["poetry", "run", "python", "-m", "streamlit", "run", "presidio_streamlit.py", "--server.port=7860", "--server.address=0.0.0.0"]