mirror of
https://github.com/crocofied/CoreControl.git
synced 2025-12-29 16:14:43 +00:00
45
agent/Dockerfile
Normal file
45
agent/Dockerfile
Normal file
@@ -0,0 +1,45 @@
|
||||
# --- Build Stage ---
|
||||
# Multi-Arch Builder mit expliziter Plattform-Angabe
|
||||
FROM --platform=$BUILDPLATFORM golang:1.19-alpine AS builder
|
||||
|
||||
ARG TARGETOS TARGETARCH
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
ENV GO111MODULE=on \
|
||||
CGO_ENABLED=0 \
|
||||
GOOS=$TARGETOS \
|
||||
GOARCH=$TARGETARCH
|
||||
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
COPY . .
|
||||
|
||||
# Cross-Compile für Zielarchitektur
|
||||
RUN go build -ldflags="-w -s" -o app ./cmd/agent
|
||||
|
||||
# --- Run Stage ---
|
||||
# Multi-Arch Laufzeit-Image
|
||||
FROM alpine:latest
|
||||
|
||||
# Notwendig für TLS/SSL-Zertifikate
|
||||
RUN apk --no-cache add ca-certificates gcompat
|
||||
|
||||
WORKDIR /root/
|
||||
|
||||
COPY --from=builder /app/app .
|
||||
|
||||
# Security Hardening
|
||||
USER nobody:nobody
|
||||
ENV GOMAXPROCS=1
|
||||
|
||||
CMD ["./app"]
|
||||
|
||||
# - - BUILD COMMAND - -
|
||||
# docker buildx build \
|
||||
# --platform linux/amd64,linux/arm64,linux/arm/v7 \
|
||||
# -t haedlessdev/corecontrol-agent:1.0.0 \
|
||||
# -t haedlessdev/corecontrol-agent:latest \
|
||||
# --push \
|
||||
# .
|
||||
Reference in New Issue
Block a user