Skip to content

Merge pull request #848 from SeriousBug/patch-1 #131

Merge pull request #848 from SeriousBug/patch-1

Merge pull request #848 from SeriousBug/patch-1 #131

Workflow file for this run

name: Building Docker Images
on: [push,pull_request]
# pull_request:
# branches:
# - 'release'
# - 'master'
# push:
# branches:
# - 'release'
# - 'master'
jobs:
generate-semantic-version:
runs-on: ubuntu-latest
container:
image: gittools/gitversion
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Run GitVersion
run: /tools/dotnet-gitversion /output buildserver
- name: Saving Results
run: |
REPOSITORY_LC=$(echo "$REPOSITORY" | tr '[:upper:]' '[:lower:]')
GitVersion_FullSemVer_Docker=$(echo "$GitVersion_FullSemVer" | tr '+' '.')
echo "GitVersion_FullSemVer_Docker=$GitVersion_FullSemVer_Docker" >> gitversion.properties
echo "GitVersion_FullSemVer=$GitVersion_FullSemVer" >> gitversion.properties
echo "GitVersion_LegacySemVer=$GitVersion_LegacySemVer" >> gitversion.properties
echo "GitVersion_Major=$GitVersion_Major" >> gitversion.properties
echo "GitVersion_MajorMinorPatch=$GitVersion_MajorMinorPatch" >> gitversion.properties
echo "GitVersion_Minor=$GitVersion_Minor" >> gitversion.properties
echo "GitVersion_Patch=$GitVersion_Patch" >> gitversion.properties
echo "GitVersion_PreReleaseLabel=$GitVersion_PreReleaseLabel" >> gitversion.properties
echo "GitVersion_PreReleaseNumber=$GitVersion_PreReleaseNumber" >> gitversion.properties
echo "GitVersion_SemVer=$GitVersion_SemVer" >> gitversion.properties
echo "REPOSITORY_LC=$REPOSITORY_LC" >> gitversion.properties
env:
REPOSITORY: '${{ github.repository }}'
- uses: actions/upload-artifact@v3
with:
name: gitversion.properties
path: gitversion.properties
build-base-image:
runs-on: ubuntu-latest
needs:
- generate-semantic-version
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
with:
name: gitversion.properties
- name: Load Variables
run: cat gitversion.properties >> $GITHUB_ENV
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push
uses: docker/build-push-action@v5
with:
cache-from: |
thespaghettidetective/web:base-1.15
thespaghettidetective/web:base
ghcr.io/${{ env.REPOSITORY_LC }}/web:base-1.15
ghcr.io/${{ env.REPOSITORY_LC }}/web:base
context: backend
file: backend/Dockerfile.base
push: true
tags: ghcr.io/${{ env.REPOSITORY_LC }}/web:base-${{ env.GitVersion_FullSemVer_Docker }}
build-base-ml-image:
runs-on: ubuntu-latest
needs:
- generate-semantic-version
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
with:
name: gitversion.properties
- name: Load Variables
run: cat gitversion.properties >> $GITHUB_ENV
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push
uses: docker/build-push-action@v5
with:
cache-from: |
thespaghettidetective/ml_api_base:1.3
thespaghettidetective/ml_api_base
ghcr.io/${{ env.REPOSITORY_LC }}/ml_api_base:1.3
ghcr.io/${{ env.REPOSITORY_LC }}/ml_api_base
context: ml_api
file: ml_api/Dockerfile.base_amd64
push: true
tags: ghcr.io/${{ env.REPOSITORY_LC }}/ml_api_base:base-${{ env.GitVersion_FullSemVer_Docker }}
build-backend-image:
runs-on: ubuntu-latest
needs:
- build-base-image
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
with:
name: gitversion.properties
- name: Load Variables
run: cat gitversion.properties >> $GITHUB_ENV
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push
uses: docker/build-push-action@v5
with:
cache-from: |
thespaghettidetective/server:base-1.13
thespaghettidetective/server:base
ghcr.io/${{ env.REPOSITORY_LC }}/server:base-1.13
ghcr.io/${{ env.REPOSITORY_LC }}/server:base
context: backend
file: backend/Dockerfile
push: true
tags: ghcr.io/${{ env.REPOSITORY_LC }}/server:${{ env.GitVersion_FullSemVer_Docker }}
build-api-image:
runs-on: ubuntu-latest
needs:
- build-base-ml-image
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
with:
name: gitversion.properties
- name: Load Variables
run: cat gitversion.properties >> $GITHUB_ENV
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push
uses: docker/build-push-action@v5
with:
cache-from: |
thespaghettidetective/ml:base-1.13
thespaghettidetective/ml:base
ghcr.io/${{ env.REPOSITORY_LC }}/ml:base-1.13
ghcr.io/${{ env.REPOSITORY_LC }}/ml:base
context: ml_api
file: ml_api/Dockerfile
push: true
tags: ghcr.io/${{ env.REPOSITORY_LC }}/ml:${{ env.GitVersion_FullSemVer_Docker }}