circulartext commited on
Commit
1130934
·
1 Parent(s): e14c2c4

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -7
Dockerfile CHANGED
@@ -24,18 +24,22 @@ RUN chown -R user:user /app && chmod -R 755 /app
24
  # Switch to the user for improved security
25
  USER user
26
 
27
- # Intermediate image with additional packages
28
- FROM debian:bullseye-slim as packages
29
 
30
- # Install su-exec using apt-get
31
- RUN apt-get update && apt-get install -y su-exec && rm -rf /var/lib/apt/lists/*
 
 
 
 
 
 
 
32
 
33
  # Final image
34
  FROM base
35
 
36
- # Copy su-exec from the packages image
37
- COPY --from=packages /usr/sbin/su-exec /usr/sbin/su-exec
38
-
39
  # Copy entrypoint.sh to /app
40
  COPY entrypoint.sh /app/entrypoint.sh
41
 
@@ -47,3 +51,4 @@ ENTRYPOINT ["/app/entrypoint.sh"]
47
 
48
  # Default command to run if the user doesn't provide a command
49
  CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860", "--reload"]
 
 
24
  # Switch to the user for improved security
25
  USER user
26
 
27
+ # Install build tools
28
+ RUN apt-get update && apt-get install -y build-essential
29
 
30
+ # Download and compile su-exec
31
+ RUN wget -O su-exec.c 'https://raw.githubusercontent.com/ncopa/su-exec/master/su-exec.c' && \
32
+ gcc -o su-exec su-exec.c
33
+
34
+ # Copy su-exec to /usr/sbin
35
+ RUN cp su-exec /usr/sbin
36
+
37
+ # Remove unnecessary build tools
38
+ RUN apt-get purge -y build-essential && apt-get autoremove -y
39
 
40
  # Final image
41
  FROM base
42
 
 
 
 
43
  # Copy entrypoint.sh to /app
44
  COPY entrypoint.sh /app/entrypoint.sh
45
 
 
51
 
52
  # Default command to run if the user doesn't provide a command
53
  CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860", "--reload"]
54
+