From 424cab64a89cc752d1ab787de5555096a9a95bb8 Mon Sep 17 00:00:00 2001 From: KoCoder Date: Sat, 15 Mar 2025 18:52:42 +0100 Subject: [PATCH] NEW: Docker builds --- .gitea/workflows/build-container.yml | 25 +++++++++++++++++++++++++ Dockerfile | 24 ++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 .gitea/workflows/build-container.yml create mode 100644 Dockerfile diff --git a/.gitea/workflows/build-container.yml b/.gitea/workflows/build-container.yml new file mode 100644 index 00000000..219b5c65 --- /dev/null +++ b/.gitea/workflows/build-container.yml @@ -0,0 +1,25 @@ +name: build-docker-imge +on: + - push + +jobs: + build: + name: Build the docker container + runs-on: ubuntu-latest + steps: + - name: "Git clone" + run: git clone ${{ gitea.server_url }}/${{ gitea.repository }}.git . + - name: "Git checkout" + run: git checkout "${{ gitea.sha }}" + - uses: aevea/action-kaniko@master + name: Run Kaniko to build our api docker container. + with: + image: kocoded/oqtane.framework + tag: ${{ git.workflow_sha }} + tag_with_latest: github.ref == 'refs/heads/master' + registry: git.kocoder.xyz + username: ${{ secrets.CI_RUNNER_USER }} + password: ${{ secrets.CI_RUNNER_TOKEN }} + build_file: Dockerfile + target: deploy + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..376c9945 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +# Build +FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build + +WORKDIR /source + +COPY --link . . + +RUN dotnet restore /source/Oqtane.sln + +RUN dotnet build "/source/Oqtane.sln" -c Release -o /source/build/ + +# Publish +FROM build AS publish + +RUN dotnet publish "Oqtane.Server/Oqtane.Server.csproj" -c Release -o /source/publish/ + +# Deploy +FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS deploy + +WORKDIR /app + + +COPY --from=publish /source/publish/ /app/ +ENTRYPOINT ["dotnet", "Oqtane.Server.dll"] \ No newline at end of file