2020-07-19 07:53:54 +00:00
|
|
|
ARG GOVERSION="1.14.6"
|
2020-05-13 16:14:10 +00:00
|
|
|
|
|
|
|
FROM golang:${GOVERSION}-alpine AS buildenv
|
|
|
|
|
|
|
|
ARG REPO="https://gitea.com/gitea/tea.git"
|
2020-05-12 09:26:53 +00:00
|
|
|
|
2020-07-19 07:53:54 +00:00
|
|
|
ARG VERSION="0.4.0"
|
2020-05-13 05:26:50 +00:00
|
|
|
ENV TEA_VERSION="${VERSION}"
|
2020-05-13 16:14:10 +00:00
|
|
|
|
2020-05-12 09:26:53 +00:00
|
|
|
ARG CGO_ENABLED="0"
|
|
|
|
ARG GOOS="linux"
|
|
|
|
|
2020-07-19 07:53:54 +00:00
|
|
|
ARG BUILD_DATE
|
|
|
|
|
2020-05-12 09:26:53 +00:00
|
|
|
WORKDIR $GOPATH/src
|
|
|
|
|
2020-05-13 16:14:10 +00:00
|
|
|
RUN apk add --quiet --no-cache git && \
|
2020-05-12 09:26:53 +00:00
|
|
|
git config --global advice.detachedHead false && \
|
2020-05-13 16:14:10 +00:00
|
|
|
if [ "${TEA_VERSION}" == "development" ]; \
|
|
|
|
then \
|
|
|
|
export TEA_VERSION="development-$(git ls-remote -q ${REPO} HEAD | cut -c-7)"; \
|
|
|
|
else \
|
|
|
|
export BRANCH_MODIFIER="-b v${TEA_VERSION}"; \
|
|
|
|
fi && \
|
|
|
|
git clone --single-branch ${REPO} ${BRANCH_MODIFIER} . && \
|
2020-05-12 09:26:53 +00:00
|
|
|
go get -v . && \
|
2020-05-13 05:26:50 +00:00
|
|
|
go build -v -a -ldflags "-X main.Version=${TEA_VERSION}" -o /tea .
|
2020-05-12 09:26:53 +00:00
|
|
|
|
|
|
|
FROM scratch
|
2020-07-19 08:05:33 +00:00
|
|
|
ARG BUILD_DATE
|
|
|
|
ARG VERSION
|
2020-07-19 07:53:54 +00:00
|
|
|
LABEL org.opencontainers.image.title="Gitea - Git with a cup of tea"
|
|
|
|
LABEL org.opencontainers.image.description="A command line tool to interact with Gitea servers"
|
2020-07-19 08:05:33 +00:00
|
|
|
LABEL org.opencontainers.image.version="${VERSION}
|
2020-07-19 07:53:54 +00:00
|
|
|
LABEL org.opencontainers.image.url="https://gitea.com/gitea/tea"
|
|
|
|
LABEL org.opencontainers.image.authors="Tamás Gérczei <tamas@gerczei.eu>"
|
|
|
|
LABEL org.opencontainers.image.created="${BUILD_DATE}"
|
|
|
|
LABEL org.opencontainers.image.source="https://github.com/tgerczei/conteaner"
|
|
|
|
LABEL org.opencontainers.image.vendor="Gérczei Tamás E.V."
|
2020-05-12 09:26:53 +00:00
|
|
|
COPY --from=buildenv /tea /
|
|
|
|
ENV HOME="/app"
|
|
|
|
ENTRYPOINT ["/tea"]
|