Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Publish container image

on:
push:
branches:
- main
tags:
- 'v*'
workflow_dispatch: # for manual trigger

jobs:
build-and-publish:
permissions:
contents: read
packages: write
runs-on: ubuntu-latest

steps:
- name: Get the code
uses: actions/checkout@v6

- name: Get .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: '10.0.x'

- name: Build x64 container image (without publishing)
if: github.ref_type != 'tag'
working-directory: src/OAuch
run: |
dotnet publish --arch x64

- name: Build and publish x64 and arm64 images
if: github.ref_type == 'tag'
working-directory: src/OAuch
env:
DOTNET_CONTAINER_REGISTRY_UNAME: ${{ github.actor }}
DOTNET_CONTAINER_REGISTRY_PWORD: ${{ secrets.GITHUB_TOKEN }}
run: |
dotnet publish -t:PublishContainer \
-p:RuntimeIdentifiers='"linux-x64;linux-arm64"' \
-p:ContainerRegistry=ghcr.io \
-p:ContainerRepository=${{ github.repository }} \
-p:ContainerImageTags='"latest;${{ github.ref_name }}"'
3 changes: 3 additions & 0 deletions src/OAuch/OAuch/OAuch.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
<None Remove="oauch.db-wal" />
<None Remove="oauch.db-wal.org" />
<None Remove="oauch.db.org" />
<ContainerEnvironmentVariable
Include="ASPNETCORE_ENVIRONMENT"
Value="Container" />
</ItemGroup>

<ItemGroup>
Expand Down
15 changes: 15 additions & 0 deletions src/OAuch/OAuch/appsettings.Container.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"Kestrel": {
"Endpoints": {
"Https": {
// rootless container cannot bind to ports < 1024
// https://devblogs.microsoft.com/dotnet/securing-containers-with-rootless/#switching-to-port-8080
"Url": "http://*:8080",
"Protocols": "Http1"
}
}
},
"ConnectionStrings": {
"OAuchDbContextConnection": "Data Source=/home/app/oauch.db;"
}
}
5 changes: 0 additions & 5 deletions src/OAuch/OAuch/appsettings.Docker.json

This file was deleted.