sigyllly commited on
Commit
a380f43
·
verified ·
1 Parent(s): e345608

Update Dockerfile

Browse files
Files changed (1) hide show
  1. 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 uploads directory and set permissions
18
- RUN mkdir -p /app/uploads && chmod -R 777 /app/uploads
19
 
20
- # Ensure the working directory is writable
 
 
 
 
 
 
 
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"]