forked from Katenary/katenary
It was too challenging to only use "tags" without a prefix to trigger builds. So, the new rule is to prefix releases tags by "releases/" Reviewed-on: Katenary/katenary#165
28 lines
980 B
Docker
28 lines
980 B
Docker
ARG GOVERSION=1.25
|
|
|
|
FROM docker.io/golang:${GOVERSION} AS builder
|
|
ARG VERSION
|
|
RUN \
|
|
if [ "${VERSION}" = "" ]; then\
|
|
echo "You must set VERSION build argument"; \
|
|
exit 1; \
|
|
fi
|
|
COPY go.mod go.sum /go/src/repo.katenary.io/katenary/katenary/
|
|
COPY cmd /go/src/repo.katenary.io/katenary/katenary/cmd
|
|
COPY internal /go/src/repo.katenary.io/katenary/katenary/internal
|
|
WORKDIR /go/src/repo.katenary.io/katenary/katenary
|
|
ENV CGO_ENABLED=0
|
|
RUN set -xe; \
|
|
export VERSION=${VERSION#releases/}; \
|
|
go build -ldflags="-X 'katenary.io/internal/generator.Version=v${VERSION}'" -trimpath -o katenary ./cmd/katenary
|
|
|
|
|
|
FROM scratch
|
|
LABEL org.opencontainers.image.source=https://repo.katenary.io/katenary/katenary
|
|
LABEL org.opencontainers.image.description="Katenary converts compose files to Helm Chart"
|
|
LABEL org.opencontainers.image.licenses=MIT
|
|
COPY --from=builder /go/src/repo.katenary.io/katenary/katenary/katenary /katenary
|
|
VOLUME /project
|
|
WORKDIR /project
|
|
ENTRYPOINT ["/katenary"]
|