Subham9126 commited on
Commit
cd3b59b
·
verified ·
1 Parent(s): 8f6c08c

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -5
Dockerfile CHANGED
@@ -1,15 +1,20 @@
1
- # 1. Build Stage
2
- FROM golang:1.21-alpine AS builder
 
3
  WORKDIR /app
4
  COPY . .
 
5
  # Initialize go module if not present
6
- RUN go mod init gdelt-sniper && go mod tidy
7
- # Build binary
8
- RUN go build -o main .
 
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