Browse Source

added development build and Go version override

development
Tamás Gérczei 5 months ago
parent
commit
eb78049c67
Signed by: tgerczei GPG Key ID: 9E1246D452248DCE
2 changed files with 20 additions and 3 deletions
  1. +14
    -3
      Dockerfile
  2. +6
    -0
      README.md

+ 14
- 3
Dockerfile View File

@@ -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 .



+ 6
- 0
README.md View File

@@ -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>'


Loading…
Cancel
Save