File size: 1,277 Bytes
1fa1dc2
8cd3e9e
60ad51d
1fa1dc2
60ad51d
 
 
 
343a392
 
 
 
60ad51d
1fa1dc2
444a581
 
 
 
 
 
60ad51d
1fa1dc2
00a618c
 
 
38bc5f3
00a618c
1fa1dc2
60ad51d
 
1fa1dc2
444a581
60ad51d
1fa1dc2
c312584
 
 
1fa1dc2
c312584
1fa1dc2
c312584
 
1fa1dc2
c312584
 
1fa1dc2
60ad51d
 
444a581
 
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 /usr/bin/code


COPY ./pyproject.toml /usr/bin/code/pyproject.toml
COPY ./poetry.lock /usr/bin/code/poetry.lock
COPY ./index.md /usr/bin/code/index.md

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

RUN poetry install --no-root --only=main

# Expose the necessary port
EXPOSE 7860

# Copy the rest of your application code
COPY . /usr/bin/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 streamlit run presidio_streamlit.py --server.port 7860 --server.address=0.0.0.0