Skip to content

New AI Server Repo

New AI Server Repo #1

Workflow file for this run

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