Update Dockerfile
Browse files- 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 |
-
#
|
|
|
|
|
|
|
|
|
|
| 22 |
WORKDIR /app
|
| 23 |
|
| 24 |
-
#
|
| 25 |
-
|
| 26 |
|
| 27 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
COPY --from=builder /app/client ./client/
|
| 29 |
|
| 30 |
-
# Expose
|
| 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"]
|