-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
60 lines (43 loc) · 1.66 KB
/
Dockerfile
File metadata and controls
60 lines (43 loc) · 1.66 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Build stage - compile the Go application
FROM golang:1.26-alpine AS builder
WORKDIR /app
# Copy go mod and sum files
COPY go.mod go.sum ./
# Download dependencies
RUN go mod download
# Copy source code
COPY . .
# Build the application
RUN CGO_ENABLED=0 GOOS=linux go build -o argo-values cmd/argo-values/main.go
# Final stage - create a minimal image
FROM alpine:latest
ARG HELM_VERSION=3.19.0-r5
ARG APP_VERSION=1.0.0
ARG GO_VERSION=1.26
# Add labels for better image identification
LABEL org.opencontainers.image.title="argo-values"
LABEL org.opencontainers.image.description="CLI tool for Argo Application values"
LABEL org.opencontainers.image.version="${APP_VERSION}"
LABEL org.opencontainers.image.helm.version="${HELM_VERSION}"
LABEL org.opencontainers.image.go.version="${GO_VERSION}"
LABEL maintainer="henning@huhehu.com"
# Create a non-root user for security
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
WORKDIR /home/appuser
# Copy the compiled binary from the builder stage to a system directory
COPY --from=builder /app/argo-values /usr/local/bin/argo-values
# Set proper permissions so all users can execute the binary
RUN chmod +x /usr/local/bin/argo-values && \
chown root:appgroup /usr/local/bin/argo-values
# Switch to root for package installation
USER root
# Install Helm (required for build command)
# Allow Helm version to be specified via build argument
# To find available versions: https://pkgs.alpinelinux.org/packages?name=helm
RUN apk add --no-cache --upgrade helm=$HELM_VERSION
# Switch back to non-root user for security
USER appuser
# Set up entrypoint
ENTRYPOINT ["argo-values"]
# Set the command to show help by default
CMD ["--help"]