From ffa0c24fd7f74148b77eb938c5735ccce259aeff Mon Sep 17 00:00:00 2001 From: morbalint Date: Thu, 7 Mar 2024 23:01:51 +0100 Subject: [PATCH] ci: experimenting with Composite.Dockerfile --- .github/workflows/ci.yml | 25 ++++++++++++++++++++++++- Kemkas.Web/Composite.Dockerfile | 15 +++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 Kemkas.Web/Composite.Dockerfile diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a013e5c..885779f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -130,6 +130,29 @@ jobs: docker push registry.digitalocean.com/kemkas/kemkas-be:${GITHUB_SHA::8} docker push ghcr.io/${{ github.repository_owner }}/kemkas-be:${GITHUB_SHA::8} + docker-composit-build: + runs-on: ubuntu-latest + + needs: + - docker-be-build + - docker-fe-build + + steps: + - uses: actions/checkout@v4 + - uses: docker/setup-buildx-action@v3 + - name: Log in to GitHub Container Registry + run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin + - uses: docker/build-push-action@v5 + with: + context: . + file: Kemkas.Web/Composite.Dockerfile + args: FE_TAG=${GITHUB_SHA::8},BE_TAG=${GITHUB_SHA::8} + cache-from: type=gha + cache-to: type=gha,mode=max + push: false + load: true + tags: ghcr.io/${{ github.repository_owner }}/kemkas/kemkas-composite:${GITHUB_SHA::8} + deploy: runs-on: ubuntu-latest needs: @@ -171,4 +194,4 @@ jobs: repo: context.repo.repo, ref: "refs/tags/${{ env.DOCKER_IMAGE_ID }}", sha: context.sha - }) \ No newline at end of file + }) diff --git a/Kemkas.Web/Composite.Dockerfile b/Kemkas.Web/Composite.Dockerfile new file mode 100644 index 0000000..557b379 --- /dev/null +++ b/Kemkas.Web/Composite.Dockerfile @@ -0,0 +1,15 @@ +FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base +WORKDIR /app +EXPOSE 80 +EXPOSE 443 + +ARG FE_TAG=latest +ARG BE_TAG=latest + +FROM ghcr.io/morbalint/kemkas-fe:${FE_TAG} as frontend +FROM ghcr.io/morbalint/kemkas-be:${BE_TAG} as backend + +FROM base AS final +COPY --from=backend /app . +COPY --from=frontend /usr/share/nginx/html ./wwwroot +ENTRYPOINT ["dotnet", "Kemkas.Web.dll"]