-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
32 lines (22 loc) · 846 Bytes
/
Dockerfile
File metadata and controls
32 lines (22 loc) · 846 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
# Builder stage
FROM golang:1.24-alpine AS builder
WORKDIR /app
# Install git and ssl certificates (needed for SDK network calls)
RUN apk add --no-cache git ca-certificates
# Cache dependencies
COPY go.mod go.sum ./
RUN go mod download
# Copy source
COPY . .
# Build static binary
# -ldflags="-w -s" strips debug information to reduce size
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-w -s" -o databricks-connector cmd/databricks-connector/main.go
# Final stage
FROM alpine:3.21
# Upgrade packages to fix vulnerabilities (e.g. busybox) and install ca-certificates
RUN apk upgrade --no-cache && apk add --no-cache ca-certificates
# Copy the binary
COPY --from=builder /app/databricks-connector /databricks-connector
# Run as non-root user (ID 65532 is commonly used for nonroot)
USER 65532:65532
ENTRYPOINT ["/databricks-connector"]