Merge branch 'main' of https://github.com/ServiceStack/ai-server #140
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Push .NET 8 Docker Image to DockerHub | |
on: | |
push: | |
branches: [main, master] | |
release: | |
types: [published] | |
workflow_dispatch: | |
jobs: | |
build_and_push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '8.0.x' | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: servicestack | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push Docker image | |
env: | |
DOCKER_REPO: servicestack/${{ github.event.repository.name }} | |
run: | | |
# Determine version tag | |
if [[ "${{ github.ref }}" == "refs/tags/"* ]]; then | |
VERSION=${GITHUB_REF#refs/tags/} | |
else | |
VERSION=${{ github.sha }} | |
fi | |
# Build and push using dotnet publish | |
dotnet publish --os linux --arch x64 -c Release \ | |
-p:PublishProfile=DefaultContainer \ | |
-p:ContainerRepository=$DOCKER_REPO \ | |
-p:ContainerImageTags="latest" | |
# Push the image | |
docker push $DOCKER_REPO:latest |