I decided to use the lesson on course 3 of the Cloud Developer Nanodegree titled Automating the Application Development Lifecycle to avoid duplication
In Automating the Application Development Lifecycle Module, Lesson 10 & Lesson 11 explain how to build your Docker image on Travis CI.
To sheds more light on using Travis CI, this documentation breaks down the commands into simple bits: https://docs.travis-ci.com/user/docker/
language: node_js
node_js:
- 13
services:
- docker
install:
- echo "nothing needs to be installed"
before_script:
- echo "no tests"
script:
- docker --version
- docker build -t NAME_OF_IMAGE .
- docker tag NAME_OF_IMAGE DOCKER_HUB_USER_NAME/DOCKER_HUB_REPO_NAME
after_success:
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
- docker push DOCKER_HUB_USER_NAME/DOCKER_HUB_REPO_NAME
language: node_js
node_js:
- 13
services:
- docker
install:
- echo "nothing needs to be installed"
before_script:
- echo "no tests"
script:
- docker --version
- docker build -t travis-simple-node .
- docker tag travis-simple-node seunfunmi/travis-simple-node:latest
after_success:
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
- docker push seunfunmi/travis-simple-node