Skip to content

Commit

Permalink
Updated docker command and build as job
Browse files Browse the repository at this point in the history
  • Loading branch information
Dhruv Sonagara authored and Dhruv Sonagara committed Aug 9, 2023
1 parent 226352a commit d7c4f91
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,20 @@ executors:
- image: circleci/openjdk:17-buster-node-browsers-legacy

jobs:
gradle_build:
executor: docker-executor
environment:
JVM_OPTS: -Xmx512m
TERM: dumb

steps:
- checkout
- setup_remote_docker:
version: 20.10.14
- run:
name: Checkstyle and spotless
command: ./gradlew build

build_and_push_tag_image:
executor: docker-executor
environment:
Expand All @@ -29,7 +43,7 @@ jobs:
fi
# Build and tag the Docker image
./gradlew build
./gradlew bootJar
docker build -t "openmf/ph-ee-connector-channel:$IMAGE_TAG" .
# Push the Docker image to Docker Hub
Expand All @@ -38,6 +52,7 @@ jobs:
# when: always # The job will be executed even if there's no match for the tag filter


build_and_push_latest_image:
executor: docker-executor
environment:
Expand All @@ -54,9 +69,10 @@ jobs:
- run:
name: Build Docker image
command: |
./gradlew build
./gradlew bootJar
docker build -t openmf/ph-ee-connector-channel:latest .
# Log in to DockerHub using environment variables
- run:
name: Login to DockerHub
Expand All @@ -71,12 +87,18 @@ workflows:
version: 2
build-and-push:
jobs:
- gradle_build:

- build_and_push_tag_image:
filters:
tags:
only: /^v\d+\.\d+\.\d+$/ # Match tags in the format v1.2.3
context:
- DOCKER
requires:
- gradle_build
- build_and_push_latest_image:
context:
- DOCKER
requires:
- gradle_build

0 comments on commit d7c4f91

Please sign in to comment.