Commit
·
cef2306
1
Parent(s):
b5a4b96
updated docker
Browse files- Dockerfile +26 -19
Dockerfile
CHANGED
@@ -1,26 +1,31 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
ENV POETRY_CACHE_DIR=/home/user/.cache/pypoetry
|
8 |
-
ENV TMPDIR=/home/user/tmp
|
9 |
|
10 |
# Install system dependencies
|
11 |
RUN apt-get update && apt-get install -y \
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
RUN pip install --no-cache-dir --upgrade pip \
|
20 |
&& pip install --no-cache-dir poetry
|
21 |
|
22 |
-
# Create
|
23 |
-
RUN
|
24 |
|
25 |
# Switch to non-root user
|
26 |
USER user
|
@@ -28,6 +33,9 @@ USER user
|
|
28 |
# Set the working directory
|
29 |
WORKDIR /home/user/app
|
30 |
|
|
|
|
|
|
|
31 |
# Copy Poetry configuration files
|
32 |
COPY --chown=user ./pyproject.toml ./poetry.lock* ./
|
33 |
|
@@ -38,8 +46,7 @@ RUN poetry config virtualenvs.create false \
|
|
38 |
# Copy application files
|
39 |
COPY --chown=user . /home/user/app
|
40 |
|
41 |
-
# Expose
|
42 |
EXPOSE 8501
|
43 |
-
|
44 |
# Run the Streamlit app
|
45 |
CMD ["streamlit", "run", "app.py", "--server.headless=true", "--server.enableCORS=false", "--server.enableXsrfProtection=false", "--server.fileWatcherType=none"]
|
|
|
1 |
+
# Install pyenv and set up Python 3.10
|
2 |
+
RUN curl https://pyenv.run | bash \
|
3 |
+
&& export PATH="/root/.pyenv/bin:$PATH" \
|
4 |
+
&& pyenv install 3.10 \
|
5 |
+
&& pyenv global 3.10 \
|
6 |
+
&& pyenv rehash
|
|
|
|
|
7 |
|
8 |
# Install system dependencies
|
9 |
RUN apt-get update && apt-get install -y \
|
10 |
+
git rsync make build-essential libssl-dev zlib1g-dev \
|
11 |
+
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \
|
12 |
+
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev \
|
13 |
+
libffi-dev liblzma-dev git-lfs ffmpeg libsm6 libxext6 cmake \
|
14 |
+
libgl1-mesa-glx fakeroot \
|
15 |
+
&& rm -rf /var/lib/apt/lists/* \
|
16 |
+
&& git lfs install
|
17 |
+
|
18 |
+
# Set up fakeroot for apt-get
|
19 |
+
RUN mv /usr/bin/apt-get /usr/bin/.apt-get && \
|
20 |
+
echo '#!/usr/bin/env sh\nfakeroot /usr/bin/.apt-get $@' > /usr/bin/apt-get && \
|
21 |
+
chmod +x /usr/bin/apt-get
|
22 |
+
|
23 |
+
# Install Poetry globally
|
24 |
RUN pip install --no-cache-dir --upgrade pip \
|
25 |
&& pip install --no-cache-dir poetry
|
26 |
|
27 |
+
# Create a non-root user
|
28 |
+
RUN useradd -m -u 1000 user
|
29 |
|
30 |
# Switch to non-root user
|
31 |
USER user
|
|
|
33 |
# Set the working directory
|
34 |
WORKDIR /home/user/app
|
35 |
|
36 |
+
# Set Poetry cache directory (optional but recommended)
|
37 |
+
ENV POETRY_CACHE_DIR=/home/user/.cache/pypoetry
|
38 |
+
|
39 |
# Copy Poetry configuration files
|
40 |
COPY --chown=user ./pyproject.toml ./poetry.lock* ./
|
41 |
|
|
|
46 |
# Copy application files
|
47 |
COPY --chown=user . /home/user/app
|
48 |
|
49 |
+
# Expose a port if needed (update according to your application)
|
50 |
EXPOSE 8501
|
|
|
51 |
# Run the Streamlit app
|
52 |
CMD ["streamlit", "run", "app.py", "--server.headless=true", "--server.enableCORS=false", "--server.enableXsrfProtection=false", "--server.fileWatcherType=none"]
|