Refactor build to include Go

Adding the baclient code to Drydock requires a refactor
of the build automation to support multiple languages
and multiple artifacts included in a single Docker image

NOTE: the go source here is a placeholder 'hello world' sample

Change-Id: I1b4883f018b33b3d4fcd7cbcb6cba660fcdc93de
This commit is contained in:
Scott Hussey 2018-08-21 16:59:36 -05:00
parent 5344ed1957
commit 0f39a55942
285 changed files with 83 additions and 57 deletions

View File

@ -1,2 +1 @@
.tox
**/build

4
.gitignore vendored
View File

@ -104,3 +104,7 @@ ENV/
# VIM
.*.swp
# Chart artifacts
charts/drydock/charts
charts/drydock/requirements.lock

View File

@ -12,18 +12,20 @@
# See the License for the specific language governing permissions and
# limitations under the License.
BUILD_DIR := $(shell mktemp -d)
BUILD_DIR := $(shell mkdir -p build && mktemp -d -p build)
DOCKER_REGISTRY ?= quay.io
IMAGE_NAME ?= drydock
IMAGE_PREFIX ?= airshipit
IMAGE_TAG ?= dev
HELM := $(BUILD_DIR)/helm
HELM := $(shell realpath $(BUILD_DIR))/helm
PROXY ?= http://proxy.foo.com:8000
NO_PROXY ?= localhost,127.0.0.1,.svc.cluster.local
USE_PROXY ?= false
PUSH_IMAGE ?= false
LABEL ?= commit-id
IMAGE ?= ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${IMAGE_TAG}
GO_BUILDER ?= docker.io/golang:1.10-alpine
export
# Build all docker images for this project
@ -101,12 +103,17 @@ helm-install:
# Make targets intended for use by the primary targets above.
.PHONY: build_drydock
build_drydock: external_dep
build_drydock: external_dep build_baclient
export; tools/drydock_image_build.sh
ifeq ($(PUSH_IMAGE), true)
docker push $(IMAGE)
endif
# Make target for building bootaction signal client
.PHONY: build_baclient
build_baclient: external_dep
docker run -tv $(shell realpath go):/work -v $(shell realpath $(BUILD_DIR)):/build -e GOPATH=/work $(GO_BUILDER) go build -o /build/baclient baclient
.PHONY: docs
docs: clean drydock_docs
@ -132,7 +139,6 @@ genconfig:
.PHONY: clean
clean:
rm -rf $(BUILD_DIR)/*
rm -rf build
rm -rf docs/build
rm -rf charts/drydock/charts
@ -143,6 +149,5 @@ pep8: external_dep
tox -e pep8
.PHONY: helm_lint
helm_lint: clean helm-init
tools/helm_tk.sh $(HELM)
helm_lint: helm-init
$(HELM) lint charts/drydock

View File

@ -0,0 +1,9 @@
package main
import (
"fmt"
)
func main() {
fmt.Printf("Hello World!\n")
}

View File

@ -18,6 +18,7 @@ ARG TRUSTED_UBUNTU_REPO=no
ARG ALLOW_UNAUTHENTICATED=false
ARG PIP_TRUSTED_HOST=foo.com
ARG PIP_INDEX_URL=https://pypi.org/simple
ARG BUILD_DIR
ENV container docker
ENV PORT 9000
ENV LC_ALL C.UTF-8
@ -37,15 +38,15 @@ WORKDIR /tmp/drydock
RUN ./hostdeps.sh; \
rm -r /var/lib/apt/lists/*
COPY ./requirements-lock.txt /tmp/drydock/
COPY ./python/requirements-lock.txt /tmp/drydock/
RUN pip3 install \
--no-cache-dir \
-r /tmp/drydock/requirements-lock.txt
COPY ./python /tmp/drydock/python
COPY ${BUILD_DIR}/baclient /tmp/drydock/python/drydock_provisioner/assets/baclient
COPY . /tmp/drydock
WORKDIR /tmp/drydock
WORKDIR /tmp/drydock/python
RUN python3 setup.py install
EXPOSE $PORT

Some files were not shown because too many files have changed in this diff Show More