mirror of https://github.com/knative/func.git
47 lines
1.2 KiB
Docker
47 lines
1.2 KiB
Docker
FROM scratch AS builder
|
|
|
|
ARG BUILDPLATFORM
|
|
ARG BUILDARCH
|
|
ARG TARGETPLATFORM
|
|
ARG TARGETARCH
|
|
|
|
ADD .artifacts/alpine-minirootfs-$BUILDARCH.tar.gz /
|
|
|
|
COPY .artifacts/go.tar.gz /tmp/go.tar.gz
|
|
RUN tar -C /usr/local -xzf /tmp/go.tar.gz
|
|
ENV PATH="/usr/local/go/bin:$PATH"
|
|
|
|
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 scratch
|
|
|
|
ARG TARGETARCH
|
|
|
|
ADD .artifacts/alpine-minirootfs-$TARGETARCH.tar.gz /
|
|
|
|
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/sh && \
|
|
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
|