diff --git a/Changelog.md b/Changelog.md index d6ffd02270ce2d93e9c0a824cc2b6246f2991428..44a2435d8d9fb23e9bbf92eed88dc825201f8d0f 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,9 @@ # Changelog +## [1.4.3] - 2019-03-14 +### Added +* option to specify the path to the Dockerfile + ## [1.4.2] - 2019-03-14 ### Added * option to specify the image name. Useful for inherent builds diff --git a/Readme.md b/Readme.md index 2a01ec4ea4448e8e4555af2401a0ef9618cc1817..6edbb72e11a6c98443dcfd5fe47ded317625e2cb 100644 --- a/Readme.md +++ b/Readme.md @@ -106,6 +106,7 @@ From now on charts located in this repository can be deployed by using the `--ch * `--build-context`: sets the build-context for `docker build` to a custom path. If omitted the path where the command is invoked is used. * `--reset`: this ignores eventually existing config-folders of docker, helm and kubectl and removes them. * `--image-name`: sets the image name in the local docker-registry. Can be useful for following builds to build upon existing builds +* `--docker-file`: sets the path to the Dockerfile ## docker publish diff --git a/assets/deployer b/assets/deployer index 564247f6273c8e7730d29ca96c6757f0f2de0070..ea44aa845c4b744765357fef42cb217550efac7a 100755 --- a/assets/deployer +++ b/assets/deployer @@ -9,6 +9,7 @@ context="context" account="account" ca_file="${HOME}/k8s-ca.crt" image_file="" +docker_file="Dockerfile" dockerconfig="" tags="" helmargs="" @@ -32,7 +33,7 @@ if [[ ${PIPESTATUS[0]} -ne 4 ]]; then fi OPTIONS= -LONGOPTS=docker-config:,tag:,build-arg:,values:,set:,set-string:,charts:,name:,token:,certificate-authority:,namespace:,cluster-url:,service-account:,output:,input:,repo-url:,build-context:,timeout:,reset,image-name: +LONGOPTS=docker-config:,tag:,build-arg:,values:,set:,set-string:,charts:,name:,token:,certificate-authority:,namespace:,cluster-url:,service-account:,output:,input:,repo-url:,build-context:,timeout:,reset,image-name:,docker-file: # -use ! and PIPESTATUS to get exit code with errexit set # -temporarily store output to be able to check for errors @@ -118,6 +119,10 @@ while true; do image_name="$2" shift 2 ;; + --docker-file) + docker_file="$2" + shift 2 + ;; --) shift break @@ -405,7 +410,7 @@ build_image() { cmd="$cmd --build-arg $arg --build-arg ${arg,,}" done - cmd="$cmd -t ${image_name} ${build_context}" + cmd="$cmd -t ${image_name} -f ${docker_file} ${build_context}" out=`$cmd 2>&1` if [ "$?" != "0" ];then echo "failed" diff --git a/docker-compose.yml b/docker-compose.yml index 5653c094330dde50b100db741082108483b3cdf5..744b76f895c23baae6ba26b4f47df21cf16a2f75 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -72,6 +72,17 @@ services: DOCKER_HOST: tcp://docker:2375 command: deployer build --build-context ./custom-context --output .tmp/image.tar.gz + build-custom-dockerfile: + build: . + volumes: + - ./:/app + - ./assets/deployer:/usr/local/bin/deployer + depends_on: + - docker + environment: + DOCKER_HOST: tcp://docker:2375 + command: deployer build --docker-file ./custom-context/Dockerfile --output .tmp/image.tar.gz + publish: build: . volumes: