Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +16 -8
Dockerfile
CHANGED
@@ -14,26 +14,34 @@ RUN apt-get update && apt-get install -y \
|
|
14 |
&& apt-get install -y python3-pip \
|
15 |
&& rm -rf /var/lib/apt/lists/*
|
16 |
|
17 |
-
# Create
|
18 |
-
RUN mkdir -p /
|
19 |
|
20 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
RUN chmod -R 777 /app
|
22 |
|
|
|
|
|
|
|
|
|
23 |
# Copy the requirements file
|
24 |
-
COPY ./requirements.txt /app/requirements.txt
|
25 |
|
26 |
# Install Python dependencies
|
27 |
RUN pip3 install --no-cache-dir --upgrade -r /app/requirements.txt
|
28 |
|
29 |
# Copy the Flask app files
|
30 |
-
COPY . .
|
31 |
|
32 |
# Expose the port the app runs on
|
33 |
EXPOSE 7860
|
34 |
|
35 |
-
# Set the PATH for the .NET tools
|
36 |
-
ENV PATH="${PATH}:/usr/bin/dotnet"
|
37 |
-
|
38 |
# Command to run the Flask app
|
39 |
CMD ["python3", "main.py"]
|
|
|
14 |
&& apt-get install -y python3-pip \
|
15 |
&& rm -rf /var/lib/apt/lists/*
|
16 |
|
17 |
+
# Create a writable directory for .NET
|
18 |
+
RUN mkdir -p /home/appuser/.dotnet && chmod -R 777 /home/appuser/.dotnet
|
19 |
|
20 |
+
# Create uploads directory
|
21 |
+
RUN mkdir -p /app/uploads
|
22 |
+
|
23 |
+
# Create a non-root user and switch to it
|
24 |
+
RUN useradd -ms /bin/bash appuser
|
25 |
+
USER appuser
|
26 |
+
|
27 |
+
# Set permissions for the working directory
|
28 |
RUN chmod -R 777 /app
|
29 |
|
30 |
+
# Set the DOTNET_HOME environment variable
|
31 |
+
ENV DOTNET_HOME="/home/appuser/.dotnet"
|
32 |
+
ENV PATH="${PATH}:${DOTNET_HOME}"
|
33 |
+
|
34 |
# Copy the requirements file
|
35 |
+
COPY --chown=appuser:appuser ./requirements.txt /app/requirements.txt
|
36 |
|
37 |
# Install Python dependencies
|
38 |
RUN pip3 install --no-cache-dir --upgrade -r /app/requirements.txt
|
39 |
|
40 |
# Copy the Flask app files
|
41 |
+
COPY --chown=appuser:appuser . .
|
42 |
|
43 |
# Expose the port the app runs on
|
44 |
EXPOSE 7860
|
45 |
|
|
|
|
|
|
|
46 |
# Command to run the Flask app
|
47 |
CMD ["python3", "main.py"]
|