Skip to content

Commit

Permalink
update dockerfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
aspriddell committed Nov 18, 2023
1 parent 1768bc0 commit 94bc29e
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 33 deletions.
47 changes: 24 additions & 23 deletions .github/workflows/publish-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,42 +12,39 @@ jobs:
runs-on: ubuntu-latest

strategy:
matrix:
project:
matrix:
project:
- { name: "DragonFruit.OnionFruit.Web", tag-prefix: "" }
- { name: "DragonFruit.OnionFruit.Web.Worker", tag-prefix: "worker-" }

steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.x'
dotnet-version: '8.0.x'

- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Setup GitHub NuGet
run: dotnet nuget update source github --username USERNAME --password ${{ github.token }} --store-password-in-clear-text

- name: Build Worker
- name: Build
run: dotnet publish -c Release -p:UseAppHost=false -p:Version=${{ github.event.release.tag_name }} ${{ matrix.project.name }}

- name: Docker Build and Push
- name: Image Build and Push
uses: docker/build-push-action@v5
with:
context: ${{ matrix.project.name }}/bin/Release/net7.0/publish
context: ${{ matrix.project.name }}/bin/Release/net8.0/publish
tags: dragonfruitdotnet/onionfruit-web:${{ matrix.project.tag-prefix }}linux
platforms: linux/arm64,linux/amd64
file: Dockerfile
file: ${{ matrix.project.name }}/Dockerfile
push: true
build-args:
- ENTRYPOINT_FILENAME=${{ matrix.project.name }}.dll
- IMAGE_VARIANT=7.0-alpine


docker-windows:
runs-on: windows-latest

Expand All @@ -56,12 +53,16 @@ jobs:
project:
- { name: "DragonFruit.OnionFruit.Web", tag-prefix: "" }
- { name: "DragonFruit.OnionFruit.Web.Worker", tag-prefix: "worker-" }

env:
DOCKER_TAG: dragonfruitdotnet/onionfruit-web:${{ matrix.project.tag-prefix }}windows

steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'

- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
Expand All @@ -70,15 +71,15 @@ jobs:
- name: Setup GitHub NuGet
run: dotnet nuget update source github --username USERNAME --password ${{ github.token }} --store-password-in-clear-text

- name: Build Worker
- name: Build
run: dotnet publish -c Release -p:UseAppHost=false -p:Version=${{ github.event.release.tag_name }} ${{ matrix.project.name }}
- name: Docker Build
run: docker build -f Dockerfile -t ${{ env.DOCKER_TAG }} --build-arg "IMAGE_VARIANT=7.0-nanoserver-ltsc2022" --build-arg "ENTRYPOINT_FILENAME=${{ matrix.project.name }}.dll" ${{ matrix.project.name }}\bin\Release\net7.0\publish
- name: Docker Push

- name: Image Build
run: docker build -f ${{ matrix.project.name }}\Dockerfile -t ${{ env.DOCKER_TAG }} --build-arg "IMAGEVARIANT=nanoserver-ltsc2022" ${{ matrix.project.name }}\bin\Release\net8.0\publish

- name: Image Push
run: docker push ${{ env.DOCKER_TAG }}

docker-multiarch-image:
runs-on: ubuntu-latest

Expand All @@ -91,9 +92,9 @@ jobs:
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Create MultiArch+MultiOS Manifest (Server)
run: docker buildx imagetools create -t dragonfruitdotnet/onionfruit-web -t dragonfruitdotnet/onionfruit-web:${{ github.event.release.tag_name }} dragonfruitdotnet/onionfruit-web:windows dragonfruitdotnet/onionfruit-web:linux

- name: Create MultiArch+MultiOS Manifest (Worker)
run: docker buildx imagetools create -t dragonfruitdotnet/onionfruit-web:worker -t dragonfruitdotnet/onionfruit-web:worker-${{ github.event.release.tag_name }} dragonfruitdotnet/onionfruit-web:worker-windows dragonfruitdotnet/onionfruit-web:worker-linux
run: docker buildx imagetools create -t dragonfruitdotnet/onionfruit-web:worker -t dragonfruitdotnet/onionfruit-web:worker-${{ github.event.release.tag_name }} dragonfruitdotnet/onionfruit-web:worker-windows dragonfruitdotnet/onionfruit-web:worker-linux
5 changes: 4 additions & 1 deletion .github/workflows/publish-server-iis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@ jobs:
runs-on: windows-latest

env:
OUTPUT_FILE_NAME: OnionFruit-Web-${{ github.ref_name }}.zip
OUTPUT_FILE_NAME: OnionFruit-Web-${{ github.event.release.tag_name }}.zip

steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'

- name: Setup GitHub NuGet
run: dotnet nuget update source github --username USERNAME --password ${{ github.token }} --store-password-in-clear-text
Expand Down
9 changes: 0 additions & 9 deletions Dockerfile

This file was deleted.

File renamed without changes.
8 changes: 8 additions & 0 deletions DragonFruit.OnionFruit.Web.Worker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ARG IMAGEVARIANT="alpine"

FROM mcr.microsoft.com/dotnet/runtime:8.0-${IMAGEVARIANT}
WORKDIR /app

COPY . .
ENV CONFIG_FOLDER_PATH="./config"
ENTRYPOINT ["dotnet", "DragonFruit.OnionFruit.Web.Worker.dll"]
25 changes: 25 additions & 0 deletions DragonFruit.OnionFruit.Web/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/.idea
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/azds.yaml
**/bin
**/charts
**/docker-compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md
8 changes: 8 additions & 0 deletions DragonFruit.OnionFruit.Web/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ARG IMAGEVARIANT="alpine"

FROM mcr.microsoft.com/dotnet/aspnet:8.0-${IMAGEVARIANT}
WORKDIR /app

COPY . .
ENV CONFIG_FOLDER_PATH="./config"
ENTRYPOINT ["dotnet", "DragonFruit.OnionFruit.Web.dll"]

0 comments on commit 94bc29e

Please sign in to comment.