-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sample project showing using a custom base image (#14)
* sample project showing using a custom base image * fix TFMs for latest stable release * fix working directory * Don't forget the actual code! * Add skia demo to sample * use the new image to prove it works * use writable dir * fix warnings
- Loading branch information
Showing
15 changed files
with
280 additions
and
30 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
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
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,82 @@ | ||
name: Custom Base Image Example | ||
|
||
on: | ||
push: | ||
workflow_dispatch: | ||
|
||
env: | ||
GITHUB_USERNAME: baronfel | ||
BASE_IMAGE: "ghcr.io/baronfel/dotnet-runtime-skia-base-image:8.0" | ||
IMAGE_NAME: baronfel/skia-app | ||
IMAGE_TAG: "8.0" | ||
|
||
jobs: | ||
create-base-image: | ||
permissions: | ||
contents: read | ||
packages: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Login to ghcr.io | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Get the code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Build the base image | ||
working-directory: src/custom-base-image | ||
run: | | ||
docker build -t ${{ env.BASE_IMAGE }} -f Dockerfile . | ||
docker push ${{ env.BASE_IMAGE }} | ||
use-base-image: | ||
needs: create-base-image | ||
permissions: | ||
contents: read | ||
packages: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Login to ghcr.io | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Get .NET | ||
uses: actions/setup-dotnet@v4 | ||
|
||
- name: Get the code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Build and publish the app | ||
working-directory: src/custom-base-image | ||
run: | | ||
dotnet publish -t:PublishContainer \ | ||
-p ContainerBaseImage="${{ env.BASE_IMAGE }}" \ | ||
-p ContainerRepository="${{ env.IMAGE_NAME}}" \ | ||
-p ContainerImageTag="${{ env.IMAGE_TAG }}" \ | ||
-p ContainerRegistry=ghcr.io | ||
run-the-image: | ||
needs: use-base-image | ||
permissions: | ||
contents: read | ||
packages: write | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Login to ghcr.io | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Execute the container | ||
run: | | ||
docker run --pull missing --rm ghcr.io/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} |
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
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
This file was deleted.
Oops, something went wrong.
Binary file not shown.
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
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,6 @@ | ||
FROM mcr.microsoft.com/dotnet/runtime:8.0 as base | ||
|
||
RUN apt-get update && apt-get install -y \ | ||
libfreetype6 \ | ||
libfontconfig1 \ | ||
&& rm -rf /var/lib/apt/lists/* |
Oops, something went wrong.