Skip to content
Snippets Groups Projects
Commit 83270de3 authored by Ulf Seltmann's avatar Ulf Seltmann
Browse files

introduces option to set path to Dockerfile

parent 43c322f2
Branches
Tags
No related merge requests found
Pipeline #1639 passed with stages
in 2 minutes and 29 seconds
# 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
......
......@@ -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
......
......@@ -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"
......
......@@ -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:
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment