xrp commited on
Commit
fb8d0b7
·
verified ·
1 Parent(s): 374e00d

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +30 -9
Dockerfile CHANGED
@@ -1,30 +1,51 @@
1
  FROM ubuntu:25.04
2
 
3
- RUN apt-get update && apt-get install -y \
 
 
 
4
  python3 \
5
  python3-pip \
6
  ca-certificates \
 
7
  && apt-get clean \
8
  && rm -rf /var/lib/apt/lists/*
9
 
10
  RUN pip3 install --no-cache-dir --break-system-packages huggingface_hub huggingface_hub[cli]
11
 
12
- WORKDIR /app
 
13
 
14
- RUN apt-get update && apt-get install -y curl && apt-get clean && rm -rf /var/lib/apt/lists/*
15
 
16
- EXPOSE 7860
 
 
 
 
 
 
 
17
 
18
  RUN echo '#!/bin/bash\n\
 
 
19
  if [ -z "$BINARY_URL" ]; then\n\
20
  echo "Error: BINARY_URL environment variable is required"\n\
21
  exit 1\n\
22
  fi\n\
23
  \n\
24
- echo "Downloading binary from: $BINARY_URL"\n\
25
- curl -L -o /app/bin "$BINARY_URL" || { echo "Failed to download binary"; exit 1; }\n\
26
- chmod +x /app/bin\n\
 
 
 
27
  \n\
28
- exec /app/bin\n' > /app/startup.sh && chmod +x /app/startup.sh
 
 
 
 
29
 
30
- ENTRYPOINT ["/app/startup.sh"]
 
1
  FROM ubuntu:25.04
2
 
3
+ # Set DEBIAN_FRONTEND to avoid interactive prompts during package installation
4
+ ENV DEBIAN_FRONTEND=noninteractive
5
+
6
+ RUN apt-get update && apt-get install -y --no-install-recommends \
7
  python3 \
8
  python3-pip \
9
  ca-certificates \
10
+ curl \
11
  && apt-get clean \
12
  && rm -rf /var/lib/apt/lists/*
13
 
14
  RUN pip3 install --no-cache-dir --break-system-packages huggingface_hub huggingface_hub[cli]
15
 
16
+ RUN addgroup --gid 1001 appgroup && \
17
+ adduser --uid 1001 --gid 1001 --disabled-password --gecos '' appuser
18
 
19
+ RUN mkdir /app && chown appuser:appgroup /app
20
 
21
+ USER appuser
22
+
23
+ ENV PATH=/home/appuser/.local/bin:$PATH \
24
+ HOME=/home/appuser
25
+
26
+ WORKDIR /app
27
+
28
+ COPY --chown=appuser:appgroup . .
29
 
30
  RUN echo '#!/bin/bash\n\
31
+ set -e\n\
32
+ \n\
33
  if [ -z "$BINARY_URL" ]; then\n\
34
  echo "Error: BINARY_URL environment variable is required"\n\
35
  exit 1\n\
36
  fi\n\
37
  \n\
38
+ echo "Downloading binary from: $BINARY_URL to ./bin"\n\
39
+ # Use relative path for output file within WORKDIR
40
+ curl -fL -o ./bin "$BINARY_URL" || { echo "Failed to download binary"; exit 1; }\n\
41
+ \n\
42
+ echo "Making binary executable: ./bin"\n\
43
+ chmod +x ./bin\n\
44
  \n\
45
+ echo "Executing binary: ./bin"\n\
46
+ # Execute using relative path
47
+ exec ./bin\n' > ./startup.sh && chmod +x ./startup.sh
48
+
49
+ EXPOSE 7860
50
 
51
+ ENTRYPOINT ["./startup.sh"]