From bcbb989f2bf668dc09658bb5a0598feef4fb076d Mon Sep 17 00:00:00 2001 From: ariannazafarana <112564573+ariannazafarana@users.noreply.github.com> Date: Wed, 11 Oct 2023 11:22:24 +0200 Subject: [PATCH] adds gitflow --- .github/workflows/build.yaml | 38 +++++++++++++++++++++++++++ .github/workflows/build_prod-uat.yaml | 36 +++++++++++++++++++++++++ Dockerfile | 19 +++++++++----- 3 files changed, 87 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/build.yaml create mode 100644 .github/workflows/build_prod-uat.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..8826150 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,38 @@ +name: "CI Develop" + +on: + push: + branches: + - '**' + - '!main' + - '!master' + paths: + - '**' + +jobs: + build-and-push: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - name: normalize branch name for tagging + run: | + NORM_TAG=$(echo "$GITHUB_REF_NAME" | tr -s "/" "-") + echo "NORM_TAG=$NORM_TAG" >> $GITHUB_ENV + - name: Log in to the Container registry + uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push on GitHub packages + uses: docker/build-push-action@v2 + with: + context: . + file: Dockerfile + push: true + tags: | + ghcr.io/${{ github.repository }}:${{ env.NORM_TAG }} \ No newline at end of file diff --git a/.github/workflows/build_prod-uat.yaml b/.github/workflows/build_prod-uat.yaml new file mode 100644 index 0000000..e35d325 --- /dev/null +++ b/.github/workflows/build_prod-uat.yaml @@ -0,0 +1,36 @@ +name: "CI RCs - PROD" + +on: + push: + tags: + - 'v*' + - '*-rc' + +jobs: + build-and-push: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - name: normalize branch name for tagging + run: | + NORM_TAG=$(echo "$GITHUB_REF_NAME" | tr -s "/" "-") + echo "NORM_TAG=$NORM_TAG" >> $GITHUB_ENV + - name: Log in to the Container registry + uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push on GitHub packages + uses: docker/build-push-action@v2 + with: + context: . + file: Dockerfile + push: true + tags: | + ghcr.io/${{ github.repository }}:${{ env.NORM_TAG }} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 3aa2b86..073c893 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,16 @@ -FROM maven:3.8.3-openjdk-17 AS MAVEN_BUILD -WORKDIR /interop-be-signal/ +## BUILD ## +FROM maven:3.8.3-openjdk-17 AS build + +WORKDIR /app + COPY . . + RUN mvn -q clean package -Dmaven.test.skip=true -FROM eclipse-temurin:17-jre-alpine -WORKDIR /app -COPY --from=MAVEN_BUILD /interop-be-signal/target/*.jar /app/app.jar -ENTRYPOINT ["java", "-jar", "app.jar"] \ No newline at end of file + +## RUN ## +FROM openjdk:17-alpine + +COPY --from=build /app/target/*.jar /app/app.jar + +ENTRYPOINT ["java", "-jar", "/app/app.jar"] \ No newline at end of file