diff --git a/.circleci/config.yml b/.circleci/config.yml index a5da9c9..f8bb0dd 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -9,6 +9,9 @@ jobs: build: docker: - image: docker:stable-git + auth: + username: $DOCKER_USER + password: $DOCKER_PASS working_directory: /dockerflow steps: - checkout @@ -25,6 +28,15 @@ jobs: "$CIRCLE_PROJECT_REPONAME" \ "$CIRCLE_BUILD_URL" > version.json + - run: + name: Login to Dockerhub + command: | + if [ "${DOCKER_USER}" == "" ] || [ "${DOCKER_PASS}" == "" ]; then + echo "Skipping Login to Dockerhub, credentials not available." + else + echo "${DOCKER_PASS}" | docker login -u="${DOCKER_USER}" --password-stdin + fi + - run: name: Build Docker image command: docker build -t app:build .