Skip to content

Docker Build PetClinic-SpringBoot Using CLIv3 #10

Docker Build PetClinic-SpringBoot Using CLIv3

Docker Build PetClinic-SpringBoot Using CLIv3 #10

name: Docker Build PetClinic-SpringBoot Using CLIv3
on:
push:
branches:
- master
paths:
- spring-boot-reactjs-ts-mysql-template/code/springboot-petclinic/**
workflow_dispatch:
env:
SERVICE_NAME: "springboot-petclinic"
CP_URL: "https://demo.control-plane-saas-cp-saas-dev.console.facets.cloud"
EMAIL: "[email protected]"
TOKEN: "62f303c8-ee53-41dc-81f4-40873b446616"
ARTIFACTORY_NAME: "default"
DOCKER_IMAGE: "app/springboot-petclinic:${{ github.run_id }}"
REGISTRATION_TYPE: "GIT_REF"
REGISTRATION_VALUE: "master"
RUN_ID: ${{ github.run_id }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Setup NodeJS
uses: actions/setup-node@v2
with:
node-version: 20
- name: Install facetsctlv3
run: |
echo "Installing @facets-cloud/facetsctlv3"
npm install -g @facets-cloud/facetsctlv3
facetsctl --version
- name: Check out the code
uses: actions/[email protected]
- name: Set up Docker Buildx
uses: docker/[email protected]
- name: Build Docker image
uses: docker/build-push-action@v2
with:
context: ./spring-boot-reactjs-ts-mysql-template/code/springboot-petclinic/
file: ./spring-boot-reactjs-ts-mysql-template/code/springboot-petclinic/Dockerfile
push: false
load: true
tags: ${{ env.DOCKER_IMAGE }}
- name: Login to facetsctlv3
run: |
echo "Logging into Facets Cloud"
facetsctl login -u ${{ env.EMAIL }} -t ${{ env.TOKEN }} -f ${{ env.CP_URL }}
- name: Initialize artifact
run: |
echo "Initializing artifact"
facetsctl artifact init -p ${{ env.SERVICE_NAME }} -s springboot -a ${{ env.ARTIFACTORY_NAME }}
- name: Push artifact
run: |
echo "Pushing artifact"
facetsctl artifact push -d ${{ env.DOCKER_IMAGE }}
- name: Register artifact
run: |
echo "Registering artifact"
facetsctl artifact register -t ${{ env.REGISTRATION_TYPE }} -i ${{ env.DOCKER_IMAGE }} -v ${{ env.REGISTRATION_VALUE }} -r ${{ env.RUN_ID }}