From 94bc29e5ac9eaee94d3059d34a935c29a735574f Mon Sep 17 00:00:00 2001 From: Albie Spriddell Date: Sat, 18 Nov 2023 17:52:44 +0000 Subject: [PATCH] update dockerfiles --- .github/workflows/publish-docker.yml | 47 ++++++++++--------- .github/workflows/publish-server-iis.yml | 5 +- Dockerfile | 9 ---- .../.dockerignore | 0 DragonFruit.OnionFruit.Web.Worker/Dockerfile | 8 ++++ DragonFruit.OnionFruit.Web/.dockerignore | 25 ++++++++++ DragonFruit.OnionFruit.Web/Dockerfile | 8 ++++ 7 files changed, 69 insertions(+), 33 deletions(-) delete mode 100644 Dockerfile rename .dockerignore => DragonFruit.OnionFruit.Web.Worker/.dockerignore (100%) create mode 100644 DragonFruit.OnionFruit.Web.Worker/Dockerfile create mode 100644 DragonFruit.OnionFruit.Web/.dockerignore create mode 100644 DragonFruit.OnionFruit.Web/Dockerfile diff --git a/.github/workflows/publish-docker.yml b/.github/workflows/publish-docker.yml index d3fbd01..694a9f5 100644 --- a/.github/workflows/publish-docker.yml +++ b/.github/workflows/publish-docker.yml @@ -12,8 +12,8 @@ jobs: runs-on: ubuntu-latest strategy: - matrix: - project: + matrix: + project: - { name: "DragonFruit.OnionFruit.Web", tag-prefix: "" } - { name: "DragonFruit.OnionFruit.Web.Worker", tag-prefix: "worker-" } @@ -21,7 +21,7 @@ jobs: - 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 @@ -29,25 +29,22 @@ jobs: 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 @@ -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 }} @@ -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 @@ -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 \ No newline at end of file + 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 diff --git a/.github/workflows/publish-server-iis.yml b/.github/workflows/publish-server-iis.yml index d093726..9aa667d 100644 --- a/.github/workflows/publish-server-iis.yml +++ b/.github/workflows/publish-server-iis.yml @@ -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 diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 2218946..0000000 --- a/Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -ARG IMAGE_VARIANT="7.0-alpine" -ARG ENTRYPOINT_FILENAME="DragonFruit.OnionFruit.Web.dll" - -FROM mcr.microsoft.com/dotnet/runtime:${IMAGE_VARIANT} -WORKDIR /app - -COPY . . -ENV CONFIG_FOLDER_PATH="./config" -ENTRYPOINT ["dotnet", "${ENTRYPOINT_FILENAME}"] \ No newline at end of file diff --git a/.dockerignore b/DragonFruit.OnionFruit.Web.Worker/.dockerignore similarity index 100% rename from .dockerignore rename to DragonFruit.OnionFruit.Web.Worker/.dockerignore diff --git a/DragonFruit.OnionFruit.Web.Worker/Dockerfile b/DragonFruit.OnionFruit.Web.Worker/Dockerfile new file mode 100644 index 0000000..03f7782 --- /dev/null +++ b/DragonFruit.OnionFruit.Web.Worker/Dockerfile @@ -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"] \ No newline at end of file diff --git a/DragonFruit.OnionFruit.Web/.dockerignore b/DragonFruit.OnionFruit.Web/.dockerignore new file mode 100644 index 0000000..cd967fc --- /dev/null +++ b/DragonFruit.OnionFruit.Web/.dockerignore @@ -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 \ No newline at end of file diff --git a/DragonFruit.OnionFruit.Web/Dockerfile b/DragonFruit.OnionFruit.Web/Dockerfile new file mode 100644 index 0000000..1ca66e0 --- /dev/null +++ b/DragonFruit.OnionFruit.Web/Dockerfile @@ -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"] \ No newline at end of file