Tofory commited on
Commit
351dbbe
·
verified ·
1 Parent(s): 4b241b9

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +5 -4
Dockerfile CHANGED
@@ -31,8 +31,9 @@ FROM python:3.12-alpine
31
  # Install necessary runtime dependencies
32
  RUN apk add --no-cache bash git
33
 
34
- # Set up a non-root user for Hugging Face compatibility
35
- RUN useradd -m -u 1000 user
 
36
  USER user
37
  ENV HOME=/home/user \
38
  PATH=/home/user/.local/bin:$PATH
@@ -44,11 +45,11 @@ WORKDIR $HOME/app
44
  COPY --from=builder /usr/local/lib/python3.12/site-packages /usr/local/lib/python3.12/site-packages
45
 
46
  # Copy the application source code from the builder and set ownership
47
- COPY --from=builder --chown=user:user /app $HOME/app
48
 
49
  # Hugging Face exposes port 7860 by default
50
  EXPOSE 7860
51
 
52
- # Command to run the application using honcho (since surf-tg.sh might need modifications)
53
  RUN pip install --user honcho
54
  CMD ["honcho", "start"]
 
31
  # Install necessary runtime dependencies
32
  RUN apk add --no-cache bash git
33
 
34
+ # Set up a non-root user for Hugging Face compatibility using adduser (Alpine specific)
35
+ RUN addgroup -g 1000 usergroup && \
36
+ adduser -D -u 1000 -G usergroup user
37
  USER user
38
  ENV HOME=/home/user \
39
  PATH=/home/user/.local/bin:$PATH
 
45
  COPY --from=builder /usr/local/lib/python3.12/site-packages /usr/local/lib/python3.12/site-packages
46
 
47
  # Copy the application source code from the builder and set ownership
48
+ COPY --from=builder --chown=user:usergroup /app $HOME/app
49
 
50
  # Hugging Face exposes port 7860 by default
51
  EXPOSE 7860
52
 
53
+ # Command to run the application using honcho
54
  RUN pip install --user honcho
55
  CMD ["honcho", "start"]