-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
679cf15
commit 68955ca
Showing
1 changed file
with
28 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,31 @@ | ||
on: 2.1 | ||
orbs: | ||
docker: circleci/docker@1.5.0 | ||
version: 2.1 | ||
executors: | ||
docker: | ||
environment: | ||
IMAGE_NAME: smz001/robofriends | ||
docker: | ||
- image: circleci/buildpack-deps:stretch | ||
docker-publisher: | ||
environment: | ||
IMAGE_NAME: ndukwearm19docker/docker-node-app | ||
docker: # Each job requires specifying an executor | ||
# (either docker, macos, or machine), see | ||
— image: circleci/node:latest | ||
auth: | ||
username: $DOCKERHUB_USERNAME | ||
password: $DOCKERHUB_PASS | ||
jobs: | ||
build: | ||
executor: docker | ||
steps: | ||
- checkout | ||
- setup_remote_docker | ||
- run: | ||
name: Build Docker image | ||
command: | | ||
docker build -t $IMAGE_NAME:latest . | ||
- run: | ||
name: Archive Docker image | ||
command: docker save -o image.tar $IMAGE_NAME | ||
- persist_to_workspace: | ||
root: . | ||
paths: | ||
- ./image.tar | ||
docker: | ||
executor: docker | ||
steps: | ||
- attach_workspace: | ||
at: /tmp/workspace | ||
- setup_remote_docker | ||
- run: | ||
name: Load archived Docker image | ||
command: docker load -i /tmp/workspace/image.tar | ||
- run: | ||
name: Publish Docker Image to Docker Hub | ||
command: | | ||
echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin | ||
docker push $IMAGE_NAME:latest | ||
publishLatestToHub: | ||
executor: docker-publisher | ||
|
||
steps: | ||
— checkout | ||
— setup_remote_docker | ||
— run: | ||
name: Publish Docker Image to Docker Hub | ||
command: | | ||
echo “$DOCKERHUB_PASSWORD” | docker login -u “$DOCKERHUB_USERNAME” — password-stdin | ||
docker build -t $IMAGE_NAME . | ||
docker push $IMAGE_NAME:latest | ||
workflows: | ||
version: 2 | ||
build-master: | ||
jobs: | ||
- build: | ||
filters: | ||
branches: | ||
only: master | ||
- docker: | ||
requires: | ||
- build | ||
filters: | ||
branches: | ||
only: master | ||
version: 2 | ||
build-master: | ||
jobs: | ||
— publishLatestToHub |