Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +10 -5
Dockerfile
CHANGED
|
@@ -1,15 +1,20 @@
|
|
| 1 |
-
# 1. Build Stage
|
| 2 |
-
FROM golang:1.
|
|
|
|
| 3 |
WORKDIR /app
|
| 4 |
COPY . .
|
|
|
|
| 5 |
# Initialize go module if not present
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
|
|
|
| 9 |
|
| 10 |
# 2. Run Stage (Tiny Image)
|
| 11 |
FROM alpine:latest
|
| 12 |
WORKDIR /root/
|
|
|
|
|
|
|
| 13 |
COPY --from=builder /app/main .
|
| 14 |
|
| 15 |
# Expose the HF Spaces port
|
|
|
|
| 1 |
+
# 1. Build Stage - CHANGED to 1.23 to fix the error
|
| 2 |
+
FROM golang:1.23-alpine AS builder
|
| 3 |
+
|
| 4 |
WORKDIR /app
|
| 5 |
COPY . .
|
| 6 |
+
|
| 7 |
# Initialize go module if not present
|
| 8 |
+
# We combine these commands to ensure clean caching
|
| 9 |
+
RUN go mod init gdelt-sniper || true && \
|
| 10 |
+
go mod tidy && \
|
| 11 |
+
go build -o main .
|
| 12 |
|
| 13 |
# 2. Run Stage (Tiny Image)
|
| 14 |
FROM alpine:latest
|
| 15 |
WORKDIR /root/
|
| 16 |
+
|
| 17 |
+
# Copy the binary from the builder
|
| 18 |
COPY --from=builder /app/main .
|
| 19 |
|
| 20 |
# Expose the HF Spaces port
|