Skip to content

Commit

Permalink
Merge pull request #708 from bcgov/jess-admin-tool
Browse files Browse the repository at this point in the history
Jess admin tool
  • Loading branch information
jjstratton authored Oct 30, 2024
2 parents 8839dd4 + 474c6b5 commit 7f0ddf9
Show file tree
Hide file tree
Showing 6 changed files with 315 additions and 0 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/build-push-common.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: diam-common

on:
push:
branches: [develop]
paths:
- "backend/common/**"
- ".github/workflows/build-push-common.yml"
workflow_dispatch:
env:
IMAGE_NAME: common
WORKING_DIRECTORY: ./backend/common
BRANCH_NAME: develop
VALUES_FILE: dev

jobs:
build:
runs-on: ubuntu-latest


if: github.event_name == 'push'

steps:
- uses: actions/checkout@v4

- name: Set environment for branch
run: |
if [[ ${{ github.ref_name }} == 'main' ]]; then
echo "BRANCH_NAME=main" >> "$GITHUB_ENV"
echo "VALUES_FILE=prod" >> "$GITHUB_ENV"
fi
if [[ ${{ github.ref_name }} == 'test' ]]; then
echo "BRANCH_NAME=test" >> "$GITHUB_ENV"
echo "VALUES_FILE=test" >> "$GITHUB_ENV"
fi
if [[ ${{ github.ref_name }} == 'develop' ]]; then
echo "BRANCH_NAME=develop" >> "$GITHUB_ENV"
echo "VALUES_FILE=dev" >> "$GITHUB_ENV"
fi
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch

- name: Branch name
run: echo running on branch ${GITHUB_REF##*/}

- name: Login to Artifactory
uses: docker/login-action@v1
with:
registry: artifacts.developer.gov.bc.ca
username: ${{ secrets.ARTIFACTORY_USERNAME }}
password: ${{ secrets.ARTIFACTORY_PASSWORD }}

- name: Dotnet Pack
working-directory: ${{env.WORKING_DIRECTORY}}
run: |
dotnet build -c Release
dotnet pack -c Release
ls -lstra
- name: Docker Push to Artifactory
working-directory: backend/common/bin/Release
run: |
nuget push *.nupkg -Source https://artifacts.developer.gov.bc.ca/artifactory/api/nuget/de27-common -apikey ${{ secrets.ARTIFACTORY_USERNAME }}:${{ secrets.ARTIFACTORY_PASSWORD }}
68 changes: 68 additions & 0 deletions .github/workflows/build-push-commonconstants.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: diam-common-constants

on:
push:
branches: [develop]
paths:
- "backend/CommonConstants/**"
- ".github/workflows/build-push-commonconstants.yml"
workflow_dispatch:
env:
IMAGE_NAME: common
WORKING_DIRECTORY: ./backend/CommonConstants
BRANCH_NAME: develop
VALUES_FILE: dev

jobs:
build:
runs-on: ubuntu-latest


if: github.event_name == 'push'

steps:
- uses: actions/checkout@v4

- name: Set environment for branch
run: |
if [[ ${{ github.ref_name }} == 'main' ]]; then
echo "BRANCH_NAME=main" >> "$GITHUB_ENV"
echo "VALUES_FILE=prod" >> "$GITHUB_ENV"
fi
if [[ ${{ github.ref_name }} == 'test' ]]; then
echo "BRANCH_NAME=test" >> "$GITHUB_ENV"
echo "VALUES_FILE=test" >> "$GITHUB_ENV"
fi
if [[ ${{ github.ref_name }} == 'develop' ]]; then
echo "BRANCH_NAME=develop" >> "$GITHUB_ENV"
echo "VALUES_FILE=dev" >> "$GITHUB_ENV"
fi
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch

- name: Branch name
run: echo running on branch ${GITHUB_REF##*/}

- name: Login to Artifactory
uses: docker/login-action@v1
with:
registry: artifacts.developer.gov.bc.ca
username: ${{ secrets.ARTIFACTORY_USERNAME }}
password: ${{ secrets.ARTIFACTORY_PASSWORD }}

- name: Dotnet Pack
working-directory: ${{env.WORKING_DIRECTORY}}
run: |
dotnet build -c Release
dotnet pack -c Release
ls -lstra
- name: Docker Push to Artifactory
working-directory: backend/CommonConstants/bin/Release
run: |
nuget push *.nupkg -Source https://artifacts.developer.gov.bc.ca/artifactory/api/nuget/de27-common -apikey ${{ secrets.ARTIFACTORY_USERNAME }}:${{ secrets.ARTIFACTORY_PASSWORD }}
67 changes: 67 additions & 0 deletions .github/workflows/build-push-commonmodels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: diam-common-models

on:
push:
branches: [develop]
paths:
- "backend/CommonModels/**"
- ".github/workflows/build-push-commonmodels.yml"
workflow_dispatch:
env:
WORKING_DIRECTORY: ./backend/CommonModels
BRANCH_NAME: develop
VALUES_FILE: dev

jobs:
build:
runs-on: ubuntu-latest


if: github.event_name == 'push'

steps:
- uses: actions/checkout@v4

- name: Set environment for branch
run: |
if [[ ${{ github.ref_name }} == 'main' ]]; then
echo "BRANCH_NAME=main" >> "$GITHUB_ENV"
echo "VALUES_FILE=prod" >> "$GITHUB_ENV"
fi
if [[ ${{ github.ref_name }} == 'test' ]]; then
echo "BRANCH_NAME=test" >> "$GITHUB_ENV"
echo "VALUES_FILE=test" >> "$GITHUB_ENV"
fi
if [[ ${{ github.ref_name }} == 'develop' ]]; then
echo "BRANCH_NAME=develop" >> "$GITHUB_ENV"
echo "VALUES_FILE=dev" >> "$GITHUB_ENV"
fi
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch

- name: Branch name
run: echo running on branch ${GITHUB_REF##*/}

- name: Login to Artifactory
uses: docker/login-action@v1
with:
registry: artifacts.developer.gov.bc.ca
username: ${{ secrets.ARTIFACTORY_USERNAME }}
password: ${{ secrets.ARTIFACTORY_PASSWORD }}

- name: Dotnet Pack
working-directory: ${{env.WORKING_DIRECTORY}}
run: |
dotnet build -c Release
dotnet pack -c Release
ls -lstra
- name: Docker Push to Artifactory
working-directory: backend/CommonModels/bin/Release
run: |
nuget push *.nupkg -Source https://artifacts.developer.gov.bc.ca/artifactory/api/nuget/de27-common -apikey ${{ secrets.ARTIFACTORY_USERNAME }}:${{ secrets.ARTIFACTORY_PASSWORD }}
38 changes: 38 additions & 0 deletions backend/Dockerfile.Common
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#------------------------------------------------------------------------------------
# WebAPI service Dockerfile
#------------------------------------------------------------------------------------

FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine AS base
WORKDIR /app
EXPOSE 8080
ENV ASPNETCORE_URLS=http://*:8080
ENV ASPNETCORE_ENVIRONMENT="Production"
ENV \
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1 \
LC_ALL=en_US.UTF-8 \
LANG=en_US.UTF-8

RUN apk add --no-cache icu-libs
RUN apk add bash

FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build

WORKDIR /src
COPY ["common/Common.csproj", "common/Common.csproj"]
COPY ["CommonConstants/CommonConstants.csproj", "CommonConstants/CommonConstants.csproj"]
RUN dotnet restore -r linux-musl-x64 "common/Common.csproj"
COPY . .
RUN dotnet build -r linux-musl-x64 "common/Common.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish -r linux-musl-x64 "common/Common.csproj" -c Release -o /app/publish
USER root

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .

USER 1001

ENTRYPOINT ["dotnet", "Common.dll"]

37 changes: 37 additions & 0 deletions backend/Dockerfile.CommonConstants
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#------------------------------------------------------------------------------------
# WebAPI service Dockerfile
#------------------------------------------------------------------------------------

FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine AS base
WORKDIR /app
EXPOSE 8080
ENV ASPNETCORE_URLS=http://*:8080
ENV ASPNETCORE_ENVIRONMENT="Production"
ENV \
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1 \
LC_ALL=en_US.UTF-8 \
LANG=en_US.UTF-8

RUN apk add --no-cache icu-libs
RUN apk add bash

FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build

WORKDIR /src
COPY ["CommonConstants/CommonConstants.csproj", "CommonConstants/CommonConstants.csproj"]
RUN dotnet restore -r linux-musl-x64 "CommonConstants/CommonConstants.csproj"
COPY . .
RUN dotnet build -r linux-musl-x64 "CommonConstants/CommonConstants.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish -r linux-musl-x64 "CommonConstants/CommonConstants.csproj" -c Release -o /app/publish
USER root

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .

USER 1001

ENTRYPOINT ["dotnet", "CommonConstants.dll"]

37 changes: 37 additions & 0 deletions backend/Dockerfile.CommonModels
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#------------------------------------------------------------------------------------
# WebAPI service Dockerfile
#------------------------------------------------------------------------------------

FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine AS base
WORKDIR /app
EXPOSE 8080
ENV ASPNETCORE_URLS=http://*:8080
ENV ASPNETCORE_ENVIRONMENT="Production"
ENV \
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1 \
LC_ALL=en_US.UTF-8 \
LANG=en_US.UTF-8

RUN apk add --no-cache icu-libs
RUN apk add bash

FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build

WORKDIR /src
COPY ["CommonModels/CommonModels.csproj", "CommonModels/CommonModels.csproj"]
RUN dotnet restore -r linux-musl-x64 "CommonModels/CommonModels.csproj"
COPY . .
RUN dotnet build -r linux-musl-x64 "CommonModels/CommonModels.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish -r linux-musl-x64 "CommonModels/CommonModels.csproj" -c Release -o /app/publish
USER root

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .

USER 1001

ENTRYPOINT ["dotnet", "CommonModels.dll"]

0 comments on commit 7f0ddf9

Please sign in to comment.