-
Notifications
You must be signed in to change notification settings - Fork 164
/
Copy pathDockerfile
37 lines (26 loc) · 1.04 KB
/
Dockerfile
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
FROM golang:1.24-alpine AS builder
WORKDIR /app
# Copy go.mod and go.sum first to leverage Docker cache
COPY go.mod go.sum ./
RUN go mod download
# Copy the rest of the source code
COPY . .
# Build the application
ARG VERSION=dev
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o girus -ldflags="-X 'github.com/badtuxx/girus-cli/cmd.Version=${VERSION}'" ./main.go
# Use a minimal alpine image for the final container
FROM alpine:3.21
# Install necessary packages
RUN apk add --no-cache ca-certificates curl bash docker-cli
# Install kind and kubectl
RUN curl -Lo /usr/local/bin/kind https://kind.sigs.k8s.io/dl/v0.20.0/kind-linux-amd64 && \
chmod +x /usr/local/bin/kind && \
curl -Lo /usr/local/bin/kubectl "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" && \
chmod +x /usr/local/bin/kubectl
WORKDIR /app
# Copy the binary from the builder stage
COPY --from=builder /app/girus /usr/local/bin/girus
# Create entrypoint
ENTRYPOINT ["/usr/local/bin/girus"]
# Default command
CMD ["help"]