diff --git a/.gitea/workflows/kub-deploy.yml b/.gitea/workflows/kub-deploy.yml index 8855680..674453a 100644 --- a/.gitea/workflows/kub-deploy.yml +++ b/.gitea/workflows/kub-deploy.yml @@ -10,31 +10,18 @@ env: IMAGE_NAME: admin/frontoffice-bff jobs: - build-and-deploy: + build: runs-on: ubuntu-latest container: image: docker:latest options: --privileged - env: - HTTP_PROXY: http://proxyuser:87zH26nbqT2@46.249.98.211:3128 - HTTPS_PROXY: http://proxyuser:87zH26nbqT2@46.249.98.211:3128 - NO_PROXY: localhost,127.0.0.1,gitea-svc,194.5.195.53,10.0.0.0/8 steps: - - name: Install dependencies - run: | - apk add --no-cache git curl - - # Install kubectl - curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" - chmod +x kubectl - mv kubectl /usr/local/bin/ - - name: Start Docker daemon with insecure registry run: | mkdir -p /etc/docker cat > /etc/docker/daemon.json << 'DAEMON' { - "insecure-registries": ["194.5.195.53:30080", "gitea-svc:3000"] + "insecure-registries": ["194.5.195.53:30080", "194.5.195.53:32500", "194.5.195.53:32082", "gitea-svc:3000"], } DAEMON mkdir -p ~/.docker @@ -63,11 +50,11 @@ jobs: - name: Build Docker Image run: | cd src - docker build -f FrontOffice.BFF.WebApi/Dockerfile \ + # استفاده از cached base images (بدون دانلود) + DOCKER_BUILDKIT=0 docker build -f FrontOffice.BFF.WebApi/Dockerfile \ -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} \ -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest \ - --build-arg HTTP_PROXY=http://proxyuser:87zH26nbqT2@46.249.98.211:3128 \ - --build-arg HTTPS_PROXY=http://proxyuser:87zH26nbqT2@46.249.98.211:3128 \ + . . @@ -77,15 +64,12 @@ jobs: docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest - - name: Deploy to Kubernetes + - name: Build and Push Complete run: | - # Setup kubeconfig - mkdir -p ~/.kube - echo "${{ secrets.KUBECONFIG }}" | base64 -d > ~/.kube/config - - # Restart deployment to pull new image - kubectl rollout restart deployment/frontoffice-bff || echo "Deployment doesn't exist yet" - - # Wait for rollout to complete - kubectl rollout status deployment/frontoffice-bff --timeout=5m || echo "Deployment rollout pending" + echo "🎉 Build and push completed successfully!" + echo "📦 Image pushed to: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}" + echo "📦 Latest tag: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest" + echo "" + echo "🚀 To deploy manually on server:" + echo "kubectl set image deployment/frontoffice-bff frontoffice-bff=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}" diff --git a/.gitea/workflows/prod-deploy.yml b/.gitea/workflows/prod-deploy.yml index 79feb76..c5727c6 100644 --- a/.gitea/workflows/prod-deploy.yml +++ b/.gitea/workflows/prod-deploy.yml @@ -24,7 +24,9 @@ jobs: - name: Install dependencies run: | apk add --no-cache git curl - curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" + # Install kubectl with fixed version + KUBECTL_VERSION="v1.31.0" + curl -LO "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl" chmod +x kubectl mv kubectl /usr/local/bin/ @@ -33,7 +35,7 @@ jobs: mkdir -p /etc/docker cat > /etc/docker/daemon.json << 'DAEMON' { - "insecure-registries": ["194.5.195.53:30080", "gitea-svc:3000"] + "insecure-registries": ["194.5.195.53:30080", "194.5.195.53:32082", "gitea-svc:3000"] } DAEMON mkdir -p ~/.docker diff --git a/src/FrontOffice.BFF.WebApi/Dockerfile b/src/FrontOffice.BFF.WebApi/Dockerfile index 85bce32..7d3b0ce 100644 --- a/src/FrontOffice.BFF.WebApi/Dockerfile +++ b/src/FrontOffice.BFF.WebApi/Dockerfile @@ -1,10 +1,10 @@ -FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base +FROM 194.5.195.53:32082/dotnet/aspnet:9.0 AS base USER $APP_UID -WORKDIR /app +WORKDATA /app EXPOSE 8080 EXPOSE 8081 -FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build +FROM 194.5.195.53:32082/dotnet/sdk:9.0 AS build ARG BUILD_CONFIGURATION=Release WORKDIR /src COPY ["FrontOffice.BFF.WebApi/NuGet.config", "NuGet.config"] diff --git a/src/FrontOffice.BFF.WebApi/NuGet.config b/src/FrontOffice.BFF.WebApi/NuGet.config index 81da29b..4861568 100644 --- a/src/FrontOffice.BFF.WebApi/NuGet.config +++ b/src/FrontOffice.BFF.WebApi/NuGet.config @@ -1,11 +1,18 @@ - + + + + + + + + diff --git a/src/Protobufs/FrontOffice.BFF.Category.Protobuf/FrontOffice.BFF.Category.Protobuf.csproj b/src/Protobufs/FrontOffice.BFF.Category.Protobuf/FrontOffice.BFF.Category.Protobuf.csproj index e8a0b5c..05a400a 100644 --- a/src/Protobufs/FrontOffice.BFF.Category.Protobuf/FrontOffice.BFF.Category.Protobuf.csproj +++ b/src/Protobufs/FrontOffice.BFF.Category.Protobuf/FrontOffice.BFF.Category.Protobuf.csproj @@ -27,7 +27,7 @@ $(PackageOutputPath)$(PackageId).$(Version).nupkg - dotnet nuget push **/*.nupkg --source https://git.afrino.co/api/packages/FourSat/nuget/index.json --api-key 061a5cb15517c6da39c16cfce8556c55ae104d0d --skip-duplicate + dotnet nuget push **/*.nupkg --source http://194.5.195.53:32081/repository/foursat-nuget-hosted/index.json --api-key admin:87zH26nbqT --skip-duplicate diff --git a/src/Protobufs/FrontOffice.BFF.City.Protobuf/FrontOffice.BFF.City.Protobuf.csproj b/src/Protobufs/FrontOffice.BFF.City.Protobuf/FrontOffice.BFF.City.Protobuf.csproj index 9e59572..950baf8 100644 --- a/src/Protobufs/FrontOffice.BFF.City.Protobuf/FrontOffice.BFF.City.Protobuf.csproj +++ b/src/Protobufs/FrontOffice.BFF.City.Protobuf/FrontOffice.BFF.City.Protobuf.csproj @@ -27,7 +27,7 @@ $(PackageOutputPath)$(PackageId).$(Version).nupkg - dotnet nuget push **/*.nupkg --source https://git.afrino.co/api/packages/FourSat/nuget/index.json --api-key 061a5cb15517c6da39c16cfce8556c55ae104d0d --skip-duplicate + dotnet nuget push **/*.nupkg --source http://194.5.195.53:32081/repository/foursat-nuget-hosted/index.json --api-key admin:87zH26nbqT --skip-duplicate diff --git a/src/Protobufs/FrontOffice.BFF.ClubMembership.Protobuf/FrontOffice.BFF.ClubMembership.Protobuf.csproj b/src/Protobufs/FrontOffice.BFF.ClubMembership.Protobuf/FrontOffice.BFF.ClubMembership.Protobuf.csproj index 8577458..7d299c0 100644 --- a/src/Protobufs/FrontOffice.BFF.ClubMembership.Protobuf/FrontOffice.BFF.ClubMembership.Protobuf.csproj +++ b/src/Protobufs/FrontOffice.BFF.ClubMembership.Protobuf/FrontOffice.BFF.ClubMembership.Protobuf.csproj @@ -26,7 +26,7 @@ $(PackageOutputPath)$(PackageId).$(Version).nupkg - dotnet nuget push **/*.nupkg --source https://git.afrino.co/api/packages/FourSat/nuget/index.json --api-key 061a5cb15517c6da39c16cfce8556c55ae104d0d --skip-duplicate + dotnet nuget push **/*.nupkg --source http://194.5.195.53:32081/repository/foursat-nuget-hosted/index.json --api-key admin:87zH26nbqT --skip-duplicate diff --git a/src/Protobufs/FrontOffice.BFF.Commission.Protobuf/FrontOffice.BFF.Commission.Protobuf.csproj b/src/Protobufs/FrontOffice.BFF.Commission.Protobuf/FrontOffice.BFF.Commission.Protobuf.csproj index 3f258b4..16621ec 100644 --- a/src/Protobufs/FrontOffice.BFF.Commission.Protobuf/FrontOffice.BFF.Commission.Protobuf.csproj +++ b/src/Protobufs/FrontOffice.BFF.Commission.Protobuf/FrontOffice.BFF.Commission.Protobuf.csproj @@ -26,7 +26,7 @@ $(PackageOutputPath)$(PackageId).$(Version).nupkg - dotnet nuget push **/*.nupkg --source https://git.afrino.co/api/packages/FourSat/nuget/index.json --api-key 061a5cb15517c6da39c16cfce8556c55ae104d0d --skip-duplicate + dotnet nuget push **/*.nupkg --source http://194.5.195.53:32081/repository/foursat-nuget-hosted/index.json --api-key admin:87zH26nbqT --skip-duplicate diff --git a/src/Protobufs/FrontOffice.BFF.Configuration.Protobuf/FrontOffice.BFF.Configuration.Protobuf.csproj b/src/Protobufs/FrontOffice.BFF.Configuration.Protobuf/FrontOffice.BFF.Configuration.Protobuf.csproj index 03df4dd..f580886 100644 --- a/src/Protobufs/FrontOffice.BFF.Configuration.Protobuf/FrontOffice.BFF.Configuration.Protobuf.csproj +++ b/src/Protobufs/FrontOffice.BFF.Configuration.Protobuf/FrontOffice.BFF.Configuration.Protobuf.csproj @@ -30,7 +30,7 @@ $(PackageOutputPath)$(PackageId).$(Version).nupkg - dotnet nuget push **/*.nupkg --source https://git.afrino.co/api/packages/FourSat/nuget/index.json --api-key 061a5cb15517c6da39c16cfce8556c55ae104d0d --skip-duplicate + dotnet nuget push **/*.nupkg --source http://194.5.195.53:32081/repository/foursat-nuget-hosted/index.json --api-key admin:87zH26nbqT --skip-duplicate diff --git a/src/Protobufs/FrontOffice.BFF.DiscountShop.Protobuf/FrontOffice.BFF.DiscountShop.Protobuf.csproj b/src/Protobufs/FrontOffice.BFF.DiscountShop.Protobuf/FrontOffice.BFF.DiscountShop.Protobuf.csproj index e6414e4..4becf02 100644 --- a/src/Protobufs/FrontOffice.BFF.DiscountShop.Protobuf/FrontOffice.BFF.DiscountShop.Protobuf.csproj +++ b/src/Protobufs/FrontOffice.BFF.DiscountShop.Protobuf/FrontOffice.BFF.DiscountShop.Protobuf.csproj @@ -26,7 +26,7 @@ $(PackageOutputPath)$(PackageId).$(Version).nupkg - dotnet nuget push **/*.nupkg --source https://git.afrino.co/api/packages/FourSat/nuget/index.json --api-key 061a5cb15517c6da39c16cfce8556c55ae104d0d --skip-duplicate + dotnet nuget push **/*.nupkg --source http://194.5.195.53:32081/repository/foursat-nuget-hosted/index.json --api-key admin:87zH26nbqT --skip-duplicate diff --git a/src/Protobufs/FrontOffice.BFF.NetworkMembership.Protobuf/FrontOffice.BFF.NetworkMembership.Protobuf.csproj b/src/Protobufs/FrontOffice.BFF.NetworkMembership.Protobuf/FrontOffice.BFF.NetworkMembership.Protobuf.csproj index 627186f..0bbdb74 100644 --- a/src/Protobufs/FrontOffice.BFF.NetworkMembership.Protobuf/FrontOffice.BFF.NetworkMembership.Protobuf.csproj +++ b/src/Protobufs/FrontOffice.BFF.NetworkMembership.Protobuf/FrontOffice.BFF.NetworkMembership.Protobuf.csproj @@ -26,7 +26,7 @@ $(PackageOutputPath)$(PackageId).$(Version).nupkg - dotnet nuget push **/*.nupkg --source https://git.afrino.co/api/packages/FourSat/nuget/index.json --api-key 061a5cb15517c6da39c16cfce8556c55ae104d0d --skip-duplicate + dotnet nuget push **/*.nupkg --source http://194.5.195.53:32081/repository/foursat-nuget-hosted/index.json --api-key admin:87zH26nbqT --skip-duplicate diff --git a/src/Protobufs/FrontOffice.BFF.Package.Protobuf/FrontOffice.BFF.Package.Protobuf.csproj b/src/Protobufs/FrontOffice.BFF.Package.Protobuf/FrontOffice.BFF.Package.Protobuf.csproj index 31deb0a..0f2e1f5 100644 --- a/src/Protobufs/FrontOffice.BFF.Package.Protobuf/FrontOffice.BFF.Package.Protobuf.csproj +++ b/src/Protobufs/FrontOffice.BFF.Package.Protobuf/FrontOffice.BFF.Package.Protobuf.csproj @@ -30,7 +30,7 @@ $(PackageOutputPath)$(PackageId).$(Version).nupkg - dotnet nuget push **/*.nupkg --source https://git.afrino.co/api/packages/FourSat/nuget/index.json --api-key 061a5cb15517c6da39c16cfce8556c55ae104d0d --skip-duplicate + dotnet nuget push **/*.nupkg --source http://194.5.195.53:32081/repository/foursat-nuget-hosted/index.json --api-key admin:87zH26nbqT --skip-duplicate diff --git a/src/Protobufs/FrontOffice.BFF.Products.Protobuf/FrontOffice.BFF.Products.Protobuf.csproj b/src/Protobufs/FrontOffice.BFF.Products.Protobuf/FrontOffice.BFF.Products.Protobuf.csproj index 889a633..1698801 100644 --- a/src/Protobufs/FrontOffice.BFF.Products.Protobuf/FrontOffice.BFF.Products.Protobuf.csproj +++ b/src/Protobufs/FrontOffice.BFF.Products.Protobuf/FrontOffice.BFF.Products.Protobuf.csproj @@ -27,7 +27,7 @@ $(PackageOutputPath)$(PackageId).$(Version).nupkg - dotnet nuget push **/*.nupkg --source https://git.afrino.co/api/packages/FourSat/nuget/index.json --api-key 061a5cb15517c6da39c16cfce8556c55ae104d0d --skip-duplicate + dotnet nuget push **/*.nupkg --source http://194.5.195.53:32081/repository/foursat-nuget-hosted/index.json --api-key admin:87zH26nbqT --skip-duplicate diff --git a/src/Protobufs/FrontOffice.BFF.ShopingCart.Protobuf/FrontOffice.BFF.ShopingCart.Protobuf.csproj b/src/Protobufs/FrontOffice.BFF.ShopingCart.Protobuf/FrontOffice.BFF.ShopingCart.Protobuf.csproj index 1bcdcc9..389da95 100644 --- a/src/Protobufs/FrontOffice.BFF.ShopingCart.Protobuf/FrontOffice.BFF.ShopingCart.Protobuf.csproj +++ b/src/Protobufs/FrontOffice.BFF.ShopingCart.Protobuf/FrontOffice.BFF.ShopingCart.Protobuf.csproj @@ -27,7 +27,7 @@ $(PackageOutputPath)$(PackageId).$(Version).nupkg - dotnet nuget push **/*.nupkg --source https://git.afrino.co/api/packages/FourSat/nuget/index.json --api-key 061a5cb15517c6da39c16cfce8556c55ae104d0d --skip-duplicate + dotnet nuget push **/*.nupkg --source http://194.5.195.53:32081/repository/foursat-nuget-hosted/index.json --api-key admin:87zH26nbqT --skip-duplicate diff --git a/src/Protobufs/FrontOffice.BFF.Transaction.Protobuf/FrontOffice.BFF.Transaction.Protobuf.csproj b/src/Protobufs/FrontOffice.BFF.Transaction.Protobuf/FrontOffice.BFF.Transaction.Protobuf.csproj index 085c923..7a56f4c 100644 --- a/src/Protobufs/FrontOffice.BFF.Transaction.Protobuf/FrontOffice.BFF.Transaction.Protobuf.csproj +++ b/src/Protobufs/FrontOffice.BFF.Transaction.Protobuf/FrontOffice.BFF.Transaction.Protobuf.csproj @@ -30,7 +30,7 @@ $(PackageOutputPath)$(PackageId).$(Version).nupkg - dotnet nuget push **/*.nupkg --source https://git.afrino.co/api/packages/FourSat/nuget/index.json --api-key 061a5cb15517c6da39c16cfce8556c55ae104d0d --skip-duplicate + dotnet nuget push **/*.nupkg --source http://194.5.195.53:32081/repository/foursat-nuget-hosted/index.json --api-key admin:87zH26nbqT --skip-duplicate diff --git a/src/Protobufs/FrontOffice.BFF.User.Protobuf/FrontOffice.BFF.User.Protobuf.csproj b/src/Protobufs/FrontOffice.BFF.User.Protobuf/FrontOffice.BFF.User.Protobuf.csproj index 1837576..57c931d 100644 --- a/src/Protobufs/FrontOffice.BFF.User.Protobuf/FrontOffice.BFF.User.Protobuf.csproj +++ b/src/Protobufs/FrontOffice.BFF.User.Protobuf/FrontOffice.BFF.User.Protobuf.csproj @@ -30,7 +30,7 @@ $(PackageOutputPath)$(PackageId).$(Version).nupkg - dotnet nuget push **/*.nupkg --source https://git.afrino.co/api/packages/FourSat/nuget/index.json --api-key 061a5cb15517c6da39c16cfce8556c55ae104d0d --skip-duplicate + dotnet nuget push **/*.nupkg --source http://194.5.195.53:32081/repository/foursat-nuget-hosted/index.json --api-key admin:87zH26nbqT --skip-duplicate diff --git a/src/Protobufs/FrontOffice.BFF.UserAddress.Protobuf/FrontOffice.BFF.UserAddress.Protobuf.csproj b/src/Protobufs/FrontOffice.BFF.UserAddress.Protobuf/FrontOffice.BFF.UserAddress.Protobuf.csproj index 3dca29b..e554990 100644 --- a/src/Protobufs/FrontOffice.BFF.UserAddress.Protobuf/FrontOffice.BFF.UserAddress.Protobuf.csproj +++ b/src/Protobufs/FrontOffice.BFF.UserAddress.Protobuf/FrontOffice.BFF.UserAddress.Protobuf.csproj @@ -30,7 +30,7 @@ $(PackageOutputPath)$(PackageId).$(Version).nupkg - dotnet nuget push **/*.nupkg --source https://git.afrino.co/api/packages/FourSat/nuget/index.json --api-key 061a5cb15517c6da39c16cfce8556c55ae104d0d --skip-duplicate + dotnet nuget push **/*.nupkg --source http://194.5.195.53:32081/repository/foursat-nuget-hosted/index.json --api-key admin:87zH26nbqT --skip-duplicate diff --git a/src/Protobufs/FrontOffice.BFF.UserOrder.Protobuf/FrontOffice.BFF.UserOrder.Protobuf.csproj b/src/Protobufs/FrontOffice.BFF.UserOrder.Protobuf/FrontOffice.BFF.UserOrder.Protobuf.csproj index e044966..21b6deb 100644 --- a/src/Protobufs/FrontOffice.BFF.UserOrder.Protobuf/FrontOffice.BFF.UserOrder.Protobuf.csproj +++ b/src/Protobufs/FrontOffice.BFF.UserOrder.Protobuf/FrontOffice.BFF.UserOrder.Protobuf.csproj @@ -30,7 +30,7 @@ $(PackageOutputPath)$(PackageId).$(Version).nupkg - dotnet nuget push **/*.nupkg --source https://git.afrino.co/api/packages/FourSat/nuget/index.json --api-key 061a5cb15517c6da39c16cfce8556c55ae104d0d --skip-duplicate + dotnet nuget push **/*.nupkg --source http://194.5.195.53:32081/repository/foursat-nuget-hosted/index.json --api-key admin:87zH26nbqT --skip-duplicate diff --git a/src/Protobufs/FrontOffice.BFF.UserWallet.Protobuf/FrontOffice.BFF.UserWallet.Protobuf.csproj b/src/Protobufs/FrontOffice.BFF.UserWallet.Protobuf/FrontOffice.BFF.UserWallet.Protobuf.csproj index 8155b7c..4501c11 100644 --- a/src/Protobufs/FrontOffice.BFF.UserWallet.Protobuf/FrontOffice.BFF.UserWallet.Protobuf.csproj +++ b/src/Protobufs/FrontOffice.BFF.UserWallet.Protobuf/FrontOffice.BFF.UserWallet.Protobuf.csproj @@ -27,7 +27,7 @@ $(PackageOutputPath)$(PackageId).$(Version).nupkg - dotnet nuget push **/*.nupkg --source https://git.afrino.co/api/packages/FourSat/nuget/index.json --api-key 061a5cb15517c6da39c16cfce8556c55ae104d0d --skip-duplicate + dotnet nuget push **/*.nupkg --source http://194.5.195.53:32081/repository/foursat-nuget-hosted/index.json --api-key admin:87zH26nbqT --skip-duplicate