-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
88 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,79 @@ | ||
name: Docker Image CI | ||
|
||
on: | ||
push: | ||
paths: | ||
- 'src/**' | ||
- '.github/workflows/**' | ||
branches: [ main ] | ||
pull_request: | ||
paths: | ||
- 'src/**' | ||
- '.github/workflows/**' | ||
branches: [ main ] | ||
|
||
jobs: | ||
build-api: | ||
|
||
runs-on: ubuntu-latest | ||
env: | ||
working-directory: ./src/Nager.PublicSuffixService | ||
|
||
permissions: | ||
contents: read | ||
packages: read | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup .NET Core | ||
uses: actions/setup-dotnet@v4 | ||
with: | ||
dotnet-version: 8.0.x | ||
- name: Install dependencies | ||
run: dotnet restore | ||
working-directory: ${{env.working-directory}} | ||
- name: Build | ||
run: dotnet build --no-restore --configuration Release | ||
working-directory: ${{env.working-directory}} | ||
- name: Publish | ||
run: dotnet publish --no-restore --configuration Release --output publish | ||
working-directory: ${{env.working-directory}} | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
# Artifact name | ||
name: api | ||
# Directory containing files to upload | ||
path: ${{env.working-directory}}/publish/ | ||
# Days before delete | ||
retention-days: 1 | ||
|
||
build-docker: | ||
|
||
needs: [build-api] | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Download artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: api | ||
path: publish | ||
- 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: | ||
context: . | ||
file: ./src/Dockerfile | ||
push: true | ||
tags: ghcr.io/${{ github.repository }}:latest |
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,9 @@ | ||
FROM mcr.microsoft.com/dotnet/aspnet:8.0.0-jammy-chiseled-amd64 | ||
|
||
# Listen ports | ||
EXPOSE 8080 | ||
|
||
# Copy files from other build jobs | ||
COPY publish . | ||
|
||
ENTRYPOINT ["dotnet", "Nager.PublicSuffixService.dll"] |