lxxweb commited on
Commit
eba1a1a
·
verified ·
1 Parent(s): 8669cee

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -6
Dockerfile CHANGED
@@ -18,17 +18,24 @@ RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-w -s" -o main .
18
  FROM alpine:3.18
19
  RUN apk --no-cache add ca-certificates
20
 
21
- # Set working directory in final image
 
 
 
22
  WORKDIR /app
23
 
24
- # Copy the compiled binary from builder
25
- COPY --from=builder /app/main .
26
 
27
- # Copy client directory from builder
 
 
 
 
28
  COPY --from=builder /app/client ./client/
29
 
30
- # Expose the port your app runs on
31
  EXPOSE 3347
32
 
33
  # Command to run the application
34
- CMD ["/app/main"]
 
18
  FROM alpine:3.18
19
  RUN apk --no-cache add ca-certificates
20
 
21
+ # Add a non-root user (UID/GID 1000, Hugging Face 默认用户)
22
+ RUN addgroup -g 1000 user && adduser -D -u 1000 -G user user
23
+
24
+ # Set working directory
25
  WORKDIR /app
26
 
27
+ # Create config directory and give permissions
28
+ RUN mkdir -p /app/config && chown -R user:user /app
29
 
30
+ # Use non-root user
31
+ USER user
32
+
33
+ # Copy the compiled binary and client directory
34
+ COPY --from=builder /app/main .
35
  COPY --from=builder /app/client ./client/
36
 
37
+ # Expose BitPlay's default port
38
  EXPOSE 3347
39
 
40
  # Command to run the application
41
+ CMD ["/app/main"]