Spaces:
Paused
Paused
debug: build from source with deep logging
Browse files- Dockerfile +29 -9
Dockerfile
CHANGED
|
@@ -1,16 +1,36 @@
|
|
| 1 |
-
FROM
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
-
#
|
| 8 |
COPY config.yaml /CLIProxyAPI/config.yaml
|
| 9 |
COPY entrypoint.sh /CLIProxyAPI/entrypoint.sh
|
| 10 |
-
RUN chmod +x /CLIProxyAPI/entrypoint.sh
|
| 11 |
|
| 12 |
-
#
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
-
#
|
| 16 |
ENTRYPOINT ["/CLIProxyAPI/entrypoint.sh"]
|
|
|
|
| 1 |
+
FROM golang:1.22-alpine AS builder
|
| 2 |
|
| 3 |
+
WORKDIR /app
|
| 4 |
+
COPY src/ .
|
| 5 |
+
# Download dependencies
|
| 6 |
+
RUN go mod download
|
| 7 |
+
# Build the application
|
| 8 |
+
RUN go build -o CLIProxyAPI cmd/cli-proxy-api/main.go
|
| 9 |
+
|
| 10 |
+
# Final stage
|
| 11 |
+
FROM alpine:latest
|
| 12 |
+
|
| 13 |
+
WORKDIR /CLIProxyAPI
|
| 14 |
+
|
| 15 |
+
# Copy binary from builder
|
| 16 |
+
COPY --from=builder /app/CLIProxyAPI /CLIProxyAPI/CLIProxyAPI
|
| 17 |
+
# Copy config example as fallback (though entrypoint uses config.yaml)
|
| 18 |
+
COPY --from=builder /app/config.example.yaml /CLIProxyAPI/config.example.yaml
|
| 19 |
|
| 20 |
+
# Copy local config and entrypoint
|
| 21 |
COPY config.yaml /CLIProxyAPI/config.yaml
|
| 22 |
COPY entrypoint.sh /CLIProxyAPI/entrypoint.sh
|
|
|
|
| 23 |
|
| 24 |
+
# Create necessary directories
|
| 25 |
+
RUN mkdir -p /CLIProxyAPI/auth /CLIProxyAPI/logs && \
|
| 26 |
+
chmod 777 /CLIProxyAPI/auth /CLIProxyAPI/logs && \
|
| 27 |
+
chmod +x /CLIProxyAPI/entrypoint.sh
|
| 28 |
+
|
| 29 |
+
# Expose port
|
| 30 |
+
EXPOSE 8080
|
| 31 |
+
|
| 32 |
+
# Volumes for persistence
|
| 33 |
+
VOLUME ["/CLIProxyAPI/auth", "/CLIProxyAPI/logs"]
|
| 34 |
|
| 35 |
+
# Set entrypoint
|
| 36 |
ENTRYPOINT ["/CLIProxyAPI/entrypoint.sh"]
|