-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
--- This adds support for Docker containerization for Nitrocid KS. --- Type: add Breaking: False Doc Required: False Backport Required: False Part: 1/1
- Loading branch information
Showing
3 changed files
with
87 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Build Project (Docker) | ||
|
||
on: | ||
push: | ||
branches: [ "main", "v0.1.0.x-saas", "v0.1.1.x-servicing" ] | ||
pull_request: | ||
branches: [ "main", "v0.1.0.x-saas", "v0.1.1.x-servicing" ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-24.04 | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.ref }} | ||
- name: Build Docker image | ||
id: push | ||
uses: docker/build-push-action | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
push: false | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Push to Docker | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v0.1.*' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-24.04 | ||
|
||
permissions: | ||
packages: write | ||
contents: read | ||
attestations: write | ||
id-token: write | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v4 | ||
- name: Prepare Docker (auth) | ||
uses: docker/login-action | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action | ||
with: | ||
images: eofla/nitrocid | ||
- name: Build and push Docker image | ||
id: push | ||
uses: docker/build-push-action | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
- name: Generate artifact attestation | ||
uses: actions/attest-build-provenance@v1 | ||
with: | ||
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} | ||
subject-digest: ${{ steps.push.outputs.digest }} | ||
push-to-registry: true |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env | ||
WORKDIR /NKS | ||
|
||
# Initialize the project files | ||
COPY . ./ | ||
|
||
# Attempt to build Nitrocid KS | ||
RUN dotnet restore | ||
RUN dotnet publish -c Release -o out | ||
|
||
# Run the ASP.NET image | ||
FROM mcr.microsoft.com/dotnet/aspnet:8.0 | ||
WORKDIR /NKS | ||
|
||
# Copy the output files and start Nitrocid KS | ||
COPY --from=build-env /NKS/out . | ||
ENTRYPOINT ["dotnet", "Nitrocid.dll"] |