mirror of https://github.com/tgerczei/conteaner
added development build and Go version override
This commit is contained in:
parent
5423135ed2
commit
eb78049c67
17
Dockerfile
17
Dockerfile
|
@ -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"
|
ARG VERSION="0.3.0"
|
||||||
ENV TEA_VERSION="${VERSION}"
|
ENV TEA_VERSION="${VERSION}"
|
||||||
|
|
||||||
ARG CGO_ENABLED="0"
|
ARG CGO_ENABLED="0"
|
||||||
ARG GOOS="linux"
|
ARG GOOS="linux"
|
||||||
|
|
||||||
WORKDIR $GOPATH/src
|
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 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 get -v . && \
|
||||||
go build -v -a -ldflags "-X main.Version=${TEA_VERSION}" -o /tea .
|
go build -v -a -ldflags "-X main.Version=${TEA_VERSION}" -o /tea .
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,12 @@
|
||||||
- export VERSION="<b>0.2.0</b>"
|
- export VERSION="<b>0.2.0</b>"
|
||||||
- docker build . -t "gitea/tea:${VERSION}" --build-arg VERSION="${VERSION}"
|
- 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
|
### Configuration
|
||||||
- docker volume create tea
|
- docker volume create tea
|
||||||
- alias tea='docker run --rm -v tea:/app gitea/tea:<b><your_release></b>'
|
- alias tea='docker run --rm -v tea:/app gitea/tea:<b><your_release></b>'
|
||||||
|
|
Loading…
Reference in New Issue