Skip to content

Commit 12ccb59

Browse files
authored
Docker registry (#7)
1 parent d7cbc79 commit 12ccb59

2 files changed

Lines changed: 15 additions & 3 deletions

File tree

.github/workflows/post-commit-pipeline.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,26 @@ jobs:
7272
- name: Build & Test
7373
run: ./gradlew clean build
7474

75-
- name: Build & push docker image
75+
- name: Build & push docker image (legacy)
7676
if: steps.version_increment.outputs.bump != 'none'
7777
env:
78+
DOCKER_REGISTRY: "https://index.docker.io/v1/"
79+
DOCKER_NAMESPACE: ${{ secrets.DOCKERHUB_USERNAME }}
7880
DOCKER_IMAGE_VERSION: "${{ steps.calculate_version.outputs.new_version }}"
7981
DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
8082
DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }}
8183
run: ./gradlew bootBuildImage
8284

85+
- name: Build & push docker image
86+
if: steps.version_increment.outputs.bump != 'none'
87+
env:
88+
DOCKER_REGISTRY: ${{ vars.DOCKER_ARTIFACT_REGISTRY }}
89+
DOCKER_NAMESPACE: ${{ vars.DOCKER_ARTIFACT_NAMESPACE }}
90+
DOCKER_IMAGE_VERSION: "${{ steps.calculate_version.outputs.new_version }}"
91+
DOCKER_USERNAME: _json_key
92+
DOCKER_PASSWORD: ${{ secrets.GCP_SA_KEY }}
93+
run: ./gradlew bootBuildImage
94+
8395
- name: Create GitHub Release
8496
if: steps.version_increment.outputs.bump != 'none'
8597
run: |

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ tasks.named('test') {
4040
}
4141

4242
bootBuildImage {
43-
imageName = "${System.getenv("DOCKER_USERNAME")}/autoinvestor-${rootProject.name}:${System.getenv("DOCKER_IMAGE_VERSION")}"
43+
imageName = "${System.getenv("DOCKER_NAMESPACE")}/autoinvestor-${rootProject.name}:${System.getenv("DOCKER_IMAGE_VERSION")}"
4444
docker {
4545
publishRegistry {
4646
username = System.getenv("DOCKER_USERNAME")
4747
password = System.getenv("DOCKER_PASSWORD")
48-
url = "https://index.docker.io/v1/"
48+
url = System.getenv("DOCKER_REGISTRY")
4949
}
5050
}
5151
publish = true

0 commit comments

Comments
 (0)