1
0
Fork 0

added development build and Go version override

Esse commit está contido em:
Tamás Gérczei 2020-05-13 18:14:10 +02:00
commit eb78049c67
Assinado por: tgerczei
ID da chave GPG: 9E1246D452248DCE
2 arquivos alterados com 20 adições e 3 exclusões

Ver arquivo

@ -1,15 +1,26 @@
FROM golang:1.14.2-alpine3.11 AS buildenv
ARG GOVERSION="1.14.2"
FROM golang:${GOVERSION}-alpine AS buildenv
ARG REPO="https://gitea.com/gitea/tea.git"
ARG VERSION="0.3.0"
ENV TEA_VERSION="${VERSION}"
ARG CGO_ENABLED="0"
ARG GOOS="linux"
WORKDIR $GOPATH/src
RUN apk add --no-cache git=2.24.3-r0 && \
RUN apk add --quiet --no-cache git && \
git config --global advice.detachedHead false && \
git clone --single-branch https://gitea.com/gitea/tea -b v${TEA_VERSION} . && \
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} . && \
go get -v . && \
go build -v -a -ldflags "-X main.Version=${TEA_VERSION}" -o /tea .

Ver arquivo

@ -8,6 +8,12 @@
- export VERSION="<b>0.2.0</b>"
- docker build . -t "gitea/tea:${VERSION}" --build-arg VERSION="${VERSION}"
...alternatively for development version:
- docker build . -t "gitea/tea:latest" --build-arg VERSION="development"
The version of Go used during the build can also be overridden by appending e.g. '--build-arg GOVERSION="<b>1.13.10</b>"'
### Configuration
- docker volume create tea
- alias tea='docker run --rm -v tea:/app gitea/tea:<b><your_release></b>'