contributed container build definition #350

Merged
lunny merged 7 commits from tgerczei/tea:master into master 2021-03-30 11:13:24 +00:00
2 changed files with 31 additions and 0 deletions

25
Dockerfile Normal file
View File

@ -0,0 +1,25 @@
ARG GOVERSION="1.16.2"
FROM golang:${GOVERSION}-alpine AS buildenv
ARG CGO_ENABLED="0"
ARG GOOS="linux"
COPY . $GOPATH/src/
WORKDIR $GOPATH/src
RUN apk add --quiet --no-cache \
make \
git && \
make build
tgerczei marked this conversation as resolved Outdated

could you use a make build here as it will use the vendored libs and wont go out to fetch them again.

could you use a make build here as it will use the vendored libs and wont go out to fetch them again.
FROM scratch
ARG VERSION="0.7.0"
LABEL org.opencontainers.image.title="tea - CLI for Gitea - git with a cup of tea"
LABEL org.opencontainers.image.description="A command line tool to interact with Gitea servers"
LABEL org.opencontainers.image.version="${VERSION}"
LABEL org.opencontainers.image.authors="Tamás Gérczei <tamas@gerczei.eu>"
LABEL org.opencontainers.image.vendor="The Gitea Authors"
COPY --from=buildenv /go/src/tea /
ENV HOME="/app"
ENTRYPOINT ["/tea"]

View File

@ -38,6 +38,8 @@ else
TEA_VERSION ?= $(shell git describe --tags --always | sed 's/-/+/' | sed 's/^v//')
endif
TEA_VERSION_TAG ?= $(shell sed 's/+/_/' <<< $(TEA_VERSION))
LDFLAGS := -X "main.Version=$(TEA_VERSION)" -X "main.Tags=$(TAGS)"
PACKAGES ?= $(shell $(GO) list ./... | grep -v /vendor/)
@ -139,6 +141,10 @@ build: $(EXECUTABLE)
$(EXECUTABLE): $(SOURCES)
$(GO) build -mod=vendor $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -o $@
.PHONY: build-image
build-image:
docker build --build-arg VERSION=$(TEA_VERSION) -t gitea/tea:$(TEA_VERSION_TAG) .
.PHONY: release
release: release-dirs release-os release-compress release-check