mirror of https://github.com/knative/func.git
35 lines
1.0 KiB
Docker
35 lines
1.0 KiB
Docker
FROM --platform=$BUILDPLATFORM index.docker.io/library/golang:1.23-alpine3.20 AS builder
|
|
|
|
ARG BUILDPLATFORM
|
|
ARG TARGETPLATFORM
|
|
ARG TARGETARCH
|
|
|
|
WORKDIR /workspace
|
|
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download -x
|
|
|
|
COPY . .
|
|
|
|
RUN GOARCH=$TARGETARCH go build -o func-util -trimpath -ldflags '-w -s' ./cmd/func-util
|
|
|
|
#########################
|
|
|
|
FROM index.docker.io/library/alpine:latest
|
|
|
|
RUN apk add --no-cache tar
|
|
|
|
COPY --from=builder /workspace/func-util /usr/local/bin/
|
|
RUN ln -s /usr/local/bin/func-util /usr/local/bin/deploy && \
|
|
ln -s /usr/local/bin/func-util /usr/local/bin/scaffold && \
|
|
ln -s /usr/local/bin/func-util /usr/local/bin/s2i && \
|
|
ln -s /usr/local/bin/func-util /usr/local/bin/socat
|
|
|
|
LABEL \
|
|
org.opencontainers.image.description="Knative Func Utils Image" \
|
|
org.opencontainers.image.source="https://github.com/knative/func" \
|
|
org.opencontainers.image.vendor="https://github.com/knative/func" \
|
|
org.opencontainers.image.url="https://github.com/knative/func/pkgs/container/func-utils"
|
|
|
|
USER 0:0
|