-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
46 lines (31 loc) · 780 Bytes
/
Dockerfile
File metadata and controls
46 lines (31 loc) · 780 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# Build stage
FROM golang:1.24-alpine AS builder
# Add git for potential dependencies
RUN apk add --no-cache git
# Set working directory
WORKDIR /app
# Copy go.mod and go.sum files (if they exist)
COPY go.mod go.sum* ./
# Verify Go version meets requirements
RUN go version
# Download dependencies
RUN go mod download
# Copy the source code
COPY . .
# Build the application
RUN CGO_ENABLED=0 GOOS=linux go build -o main .
# Final stage
FROM alpine
# Add ca-certificates for HTTPS calls to GitHub API
RUN apk --no-cache add ca-certificates
WORKDIR /app
# Copy the binary from builder
COPY --from=builder /app/main .
# Copy static files
COPY .. ./
# Expose the port the app runs on
EXPOSE 8080
# Set environment variables
ENV PORT=8080
# Run the binary
CMD ["./main"]