improved dockerfile
Browse files- Dockerfile +7 -27
Dockerfile
CHANGED
@@ -1,44 +1,24 @@
|
|
1 |
-
|
2 |
-
FROM python:3.9 AS builder
|
3 |
|
4 |
-
# Create a non-root user
|
5 |
RUN useradd -m -u 1000 user
|
6 |
USER user
|
|
|
7 |
|
8 |
-
# Set the working directory
|
9 |
WORKDIR /app
|
10 |
|
11 |
-
# Copy requirements file and install dependencies
|
12 |
COPY --chown=user ./requirements.txt requirements.txt
|
13 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
14 |
|
|
|
|
|
15 |
|
16 |
-
#
|
17 |
-
|
18 |
-
|
19 |
-
# Create the same non-root user for consistency
|
20 |
-
RUN useradd -m -u 1000 user
|
21 |
-
USER user
|
22 |
-
|
23 |
-
# Set the environment PATH
|
24 |
-
ENV PATH="/home/user/.local/bin:$PATH"
|
25 |
-
|
26 |
-
# Set the working directory
|
27 |
-
WORKDIR /app
|
28 |
-
|
29 |
-
# Copy Python dependencies from the build stage
|
30 |
-
COPY --from=builder /usr/local/lib/python3.9 /usr/local/lib/python3.9
|
31 |
-
COPY --from=builder /usr/local/bin /usr/local/bin
|
32 |
|
33 |
# Copy the application code
|
34 |
COPY --chown=user . /app
|
35 |
|
36 |
-
# Expose the port for Streamlit
|
37 |
-
EXPOSE 7860
|
38 |
-
|
39 |
-
# Add and set up the startup script
|
40 |
COPY --chown=user ./startup.sh /app/startup.sh
|
41 |
RUN chmod +x /app/startup.sh
|
42 |
|
43 |
-
|
44 |
-
CMD ["/app/startup.sh"]
|
|
|
1 |
+
FROM python:3.9
|
|
|
2 |
|
|
|
3 |
RUN useradd -m -u 1000 user
|
4 |
USER user
|
5 |
+
ENV PATH="/home/user/.local/bin:$PATH"
|
6 |
|
|
|
7 |
WORKDIR /app
|
8 |
|
|
|
9 |
COPY --chown=user ./requirements.txt requirements.txt
|
10 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
11 |
|
12 |
+
RUN apt-get update && apt-get install git -y && apt-get install curl -y
|
13 |
+
RUN curl -fsSL https://ollama.com/install.sh | sh
|
14 |
|
15 |
+
# Ensure `ollama` is installed
|
16 |
+
RUN python -m pip show ollama
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
# Copy the application code
|
19 |
COPY --chown=user . /app
|
20 |
|
|
|
|
|
|
|
|
|
21 |
COPY --chown=user ./startup.sh /app/startup.sh
|
22 |
RUN chmod +x /app/startup.sh
|
23 |
|
24 |
+
CMD ["/app/startup.sh"]
|
|