Commit
·
a3db5d7
1
Parent(s):
4d3ec1f
updated docker
Browse files- Dockerfile +23 -23
Dockerfile
CHANGED
@@ -1,43 +1,43 @@
|
|
1 |
FROM nvidia/cuda:12.1.1-devel-ubuntu22.04
|
2 |
|
|
|
3 |
ENV HOST 0.0.0.0
|
4 |
-
|
5 |
-
|
6 |
|
7 |
# Install system dependencies for Python and build tools
|
8 |
RUN apt-get update && apt-get install -y \
|
9 |
-
python3 python3-pip build-essential git
|
|
|
10 |
|
11 |
# Create a non-root user
|
12 |
RUN useradd -m -u 1000 user
|
13 |
|
14 |
-
#ENV POETRY_CACHE_DIR=/home/user/.cache/pypoetry
|
15 |
-
|
16 |
-
ENV HOME /home/user
|
17 |
-
ENV PATH $HOME/.local/bin:$PATH
|
18 |
-
|
19 |
-
|
20 |
# Install Poetry globally as root
|
21 |
RUN pip install --no-cache-dir --upgrade pip \
|
22 |
-
&& poetry config virtualenvs.create false \
|
23 |
&& pip install --no-cache-dir poetry
|
24 |
|
25 |
-
|
26 |
USER user
|
27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
# Install dependencies with Poetry
|
30 |
-
RUN poetry
|
|
|
31 |
|
32 |
-
|
33 |
-
|
34 |
-
WORKDIR $HOME/app
|
35 |
-
COPY --chown=user . $HOME/app
|
36 |
|
37 |
-
#
|
38 |
EXPOSE 8501
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
--server.enableXsrfProtection false \
|
43 |
-
--server.fileWatcherType none
|
|
|
1 |
FROM nvidia/cuda:12.1.1-devel-ubuntu22.04
|
2 |
|
3 |
+
# System-level environment variables
|
4 |
ENV HOST 0.0.0.0
|
5 |
+
ENV HOME /home/user
|
6 |
+
ENV PATH $HOME/.local/bin:$PATH
|
7 |
|
8 |
# Install system dependencies for Python and build tools
|
9 |
RUN apt-get update && apt-get install -y \
|
10 |
+
python3 python3-pip build-essential git \
|
11 |
+
&& rm -rf /var/lib/apt/lists/*
|
12 |
|
13 |
# Create a non-root user
|
14 |
RUN useradd -m -u 1000 user
|
15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
# Install Poetry globally as root
|
17 |
RUN pip install --no-cache-dir --upgrade pip \
|
|
|
18 |
&& pip install --no-cache-dir poetry
|
19 |
|
20 |
+
# Switch to non-root user
|
21 |
USER user
|
22 |
+
|
23 |
+
# Ensure Poetry works for non-root user
|
24 |
+
ENV POETRY_CACHE_DIR=/home/user/.cache/pypoetry
|
25 |
+
|
26 |
+
# Set the working directory
|
27 |
+
WORKDIR /home/user/app
|
28 |
+
|
29 |
+
# Copy Poetry configuration files
|
30 |
+
COPY --chown=user ./pyproject.toml ./poetry.lock* ./
|
31 |
|
32 |
# Install dependencies with Poetry
|
33 |
+
RUN poetry config virtualenvs.create false \
|
34 |
+
&& poetry install --only main --no-interaction --no-ansi
|
35 |
|
36 |
+
# Copy application files
|
37 |
+
COPY --chown=user . /home/user/app
|
|
|
|
|
38 |
|
39 |
+
# Expose the Streamlit default port
|
40 |
EXPOSE 8501
|
41 |
+
|
42 |
+
# Run the Streamlit app
|
43 |
+
CMD ["streamlit", "run", "app.py", "--server.headless=true", "--server.enableCORS=false", "--server.enableXsrfProtection=false", "--server.fileWatcherType=none"]
|
|
|
|