Simple single bash command script to:
- build a tagged Docker image
- push it into Docker repository
- force Kubernetes rolling deployment within selected namespace
- Docker image name is the same as Kubernetes deployment name.
kubectl
is authorized to connect to Kubernetes cluster- If you're using Docker private repository - you're authorized already with
docker login
- Copy
build.sh
into your executable environment $PATH.
example:
cp ./build.sh /usr/local/bin/build
- Add required environment variables listed in
.env
file into your project.env
whereDockerfile
is located
example:
cat ./env >> /path_to_your_project_where_Dockerfile_is_located/.env
build --help
examples:
build a Docker image tagged as latest
& push it into Docker repository:
build
build a Docker image tagged as 1.0.0
, push it into Docker repository and patch Kubernetes deployment to use it in production namespace:
build 1.0.0 PROD