go all the way
This commit is contained in:
		
							parent
							
								
									3cf7d89363
								
							
						
					
					
						commit
						4ddff5bb25
					
				|  | @ -25,10 +25,8 @@ export BINARY GHUSER HBREPO MAINT VENDOR DESC GOLANGCI_LINT_ARGS CONFIG_FILE LIC | |||
| # Fix the repo if it doesn't match the binary name. | ||||
| # Provide a better URL if one exists. | ||||
| 
 | ||||
| # Used as go import path in docker and homebrew builds. | ||||
| IMPORT_PATH="github.com/${GHUSER}/${BINARY}" | ||||
| # Used for source links and wiki links. | ||||
| SOURCE_URL="https://${IMPORT_PATH}" | ||||
| SOURCE_URL="https://github.com/${GHUSER}/${BINARY}" | ||||
| # Used for documentation links. | ||||
| URL="${SOURCE_URL}" | ||||
| 
 | ||||
|  | @ -40,9 +38,7 @@ ITERATION=$(git rev-list --count --all || echo 0) | |||
| DATE="$(date -u +%Y-%m-%dT%H:%M:%SZ)" | ||||
| COMMIT="$(git rev-parse --short HEAD || echo 0)" | ||||
| 
 | ||||
| # Used by homebrew downloads. | ||||
| #SOURCE_PATH=https://codeload.${IMPORT_PATH}/tar.gz/v${VERSION} | ||||
| # This is a custom download path for homebrew formula. | ||||
| SOURCE_PATH=https://golift.io/${BINARY}/archive/v${VERSION}.tar.gz | ||||
| 
 | ||||
| export IMPORT_PATH SOURCE_URL URL VVERSION VERSION ITERATION DATE COMMIT SOURCE_PATH | ||||
| export SOURCE_URL URL VVERSION VERSION ITERATION DATE COMMIT SOURCE_PATH | ||||
|  |  | |||
							
								
								
									
										2
									
								
								Makefile
								
								
								
								
							
							
						
						
									
										2
									
								
								Makefile
								
								
								
								
							|  | @ -231,7 +231,6 @@ docker: | |||
| 		--build-arg "VENDOR=$(VENDOR)" \
 | ||||
| 		--build-arg "AUTHOR=$(MAINT)" \
 | ||||
| 		--build-arg "BINARY=$(BINARY)" \
 | ||||
| 		--build-arg "IMPORT_PATH=$(IMPORT_PATH)" \
 | ||||
| 		--build-arg "SOURCE_URL=$(SOURCE_URL)" \
 | ||||
| 		--build-arg "CONFIG_FILE=$(CONFIG_FILE)" \
 | ||||
| 		--tag $(BINARY) . | ||||
|  | @ -250,7 +249,6 @@ $(BINARY).rb: v$(VERSION).tar.gz.sha256 init/homebrew/$(FORMULA).rb.tmpl | |||
| 		-e "s/{{SHA256}}/$(shell head -c64 $<)/g" \
 | ||||
| 		-e "s/{{Desc}}/$(DESC)/g" \
 | ||||
| 		-e "s%{{URL}}%$(URL)%g" \
 | ||||
| 		-e "s%{{IMPORT_PATH}}%$(IMPORT_PATH)%g" \
 | ||||
| 		-e "s%{{SOURCE_PATH}}%$(SOURCE_PATH)%g" \
 | ||||
| 		-e "s%{{SOURCE_URL}}%$(SOURCE_URL)%g" \
 | ||||
| 		-e "s%{{CONFIG_FILE}}%$(CONFIG_FILE)%g" \
 | ||||
|  |  | |||
|  | @ -9,21 +9,15 @@ ARG BUILD_DATE=0 | |||
| ARG COMMIT=0 | ||||
| ARG VERSION=unknown | ||||
| ARG BINARY=application-builder | ||||
| ARG IMPORT_PATH=github.com/golift/application-builder | ||||
| 
 | ||||
| FROM golang:stretch as builder | ||||
| ARG ARCH | ||||
| ARG OS | ||||
| ARG BINARY | ||||
| ARG IMPORT_PATH | ||||
| 
 | ||||
| RUN mkdir -p $GOPATH/pkg/mod $GOPATH/bin $GOPATH/src/${IMPORT_PATH} | ||||
| RUN apt-get update \ | ||||
|   && apt-get install -y curl  \ | ||||
|   && curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh | ||||
| 
 | ||||
| COPY . $GOPATH/src/${IMPORT_PATH} | ||||
| WORKDIR $GOPATH/src/${IMPORT_PATH} | ||||
| RUN mkdir -p $GOPATH/pkg/mod $GOPATH/bin $GOPATH/src /${BINARY} | ||||
| COPY . /${BINARY} | ||||
| WORKDIR /${BINARY} | ||||
| 
 | ||||
| RUN go mod vendor \ | ||||
|   && CGO_ENABLED=0 make ${BINARY}.${ARCH}.${OS} | ||||
|  | @ -36,7 +30,6 @@ ARG COMMIT | |||
| ARG VERSION | ||||
| ARG LICENSE=MIT | ||||
| ARG BINARY | ||||
| ARG IMPORT_PATH | ||||
| ARG SOURCE_URL=http://github.com/golift/application-builder | ||||
| ARG URL=http://github.com/golift/application-builder | ||||
| ARG DESC=application-builder | ||||
|  | @ -58,8 +51,8 @@ LABEL org.opencontainers.image.created="${BUILD_DATE}" \ | |||
|       org.opencontainers.image.licenses="${LICENSE}" \ | ||||
|       org.opencontainers.image.version="${VERSION}" | ||||
| 
 | ||||
| COPY --from=builder /go/src/${IMPORT_PATH}/${BINARY}.${ARCH}.${OS} /image | ||||
| COPY --from=builder /go/src/${IMPORT_PATH}/examples/${CONFIG_FILE}.example /etc/${BINARY}/${CONFIG_FILE} | ||||
| COPY --from=builder /${BINARY}/${BINARY}.${ARCH}.${OS} /image | ||||
| COPY --from=builder /${BINARY}/examples/${CONFIG_FILE}.example /etc/${BINARY}/${CONFIG_FILE} | ||||
| COPY --from=builder /etc/ssl /etc/ssl | ||||
| 
 | ||||
| VOLUME [ "/etc/${BINARY}" ] | ||||
|  |  | |||
|  | @ -28,7 +28,6 @@ for build in $BUILDS; do | |||
|     --build-arg "VENDOR=${VENDOR}" \ | ||||
|     --build-arg "AUTHOR=${MAINT}" \ | ||||
|     --build-arg "BINARY=${BINARY}" \ | ||||
|     --build-arg "IMPORT_PATH=${IMPORT_PATH}" \ | ||||
|     --build-arg "SOURCE_URL=${SOURCE_URL}" \ | ||||
|     --build-arg "CONFIG_FILE=${CONFIG_FILE}" \ | ||||
|     --tag "${IMAGE_NAME}_${os}_${name}" \ | ||||
|  |  | |||
|  | @ -1,7 +1,6 @@ | |||
| # Homebrew Formula Template. Built by Makefile: `make fomula` | ||||
| # This is part of Application Builder. | ||||
| # https://github.com/golift/application-builder | ||||
| # This file is used when FORMULA is set to 'service'. | ||||
| class {{Class}} < Formula | ||||
|   desc "{{Desc}}" | ||||
|   homepage "{{URL}}" | ||||
|  | @ -13,14 +12,11 @@ class {{Class}} < Formula | |||
|   depends_on "dep" | ||||
| 
 | ||||
|   def install | ||||
|     ENV["GOPATH"] = buildpath | ||||
| 
 | ||||
|     bin_path = buildpath/"src/{{IMPORT_PATH}}" | ||||
|     # Copy all files from their current location (GOPATH root) | ||||
|     # to $GOPATH/src/{{IMPORT_PATH}} | ||||
|     bin_path = buildpath/"#{name}" | ||||
|     # Copy all files from their current location to buildpath/#{name} | ||||
|     bin_path.install Dir["*",".??*"] | ||||
|     cd bin_path do | ||||
|       system "dep", "ensure", "--vendor-only" | ||||
|       system "make" "vendor" | ||||
|       system "make", "install", "VERSION=#{version}", "ITERATION={{Iter}}", "PREFIX=#{prefix}", "ETC=#{etc}" | ||||
|       # If this fails, the user gets a nice big warning about write permissions on their | ||||
|       # #{var}/log folder. The alternative could be letting the app silently fail | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue