Merge remote-tracking branch 'kub-stage/kub-stage' into kub-stage

# Conflicts:
#	.gitea/workflows/kub-deploy.yml
#	.github/workflows/kub-deploy.yml
#	src/FrontOffice.BFF.WebApi/Dockerfile
This commit is contained in:
masoodafar-web
2025-12-06 23:23:55 +03:30
2 changed files with 0 additions and 125 deletions

View File

@@ -1,91 +0,0 @@
name: Build and Deploy to Kubernetes
on:
push:
branches:
- kub-stage
env:
REGISTRY: gitea-svc:3000
IMAGE_NAME: admin/frontoffice-bff
jobs:
build-and-deploy:
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"]
}
DAEMON
mkdir -p ~/.docker
cat > ~/.docker/config.json << 'CONF'
{
"proxies": {
"default": {
"httpProxy": "http://proxyuser:87zH26nbqT2@46.249.98.211:3128",
"httpsProxy": "http://proxyuser:87zH26nbqT2@46.249.98.211:3128",
"noProxy": "localhost,127.0.0.1,gitea-svc,194.5.195.53,10.0.0.0/8"
}
}
}
CONF
dockerd &
for i in $(seq 1 30); do
docker info >/dev/null 2>&1 && break || sleep 2
done
docker info
- name: Checkout code
run: |
git clone --depth 1 --branch kub-stage http://gitea-svc:3000/admin/FrontOffice.BFF.git .
git log -1 --format="%H %s"
- name: Build Docker Image
run: |
cd src
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 \
.
- name: Push to Registry
run: |
echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login ${{ env.REGISTRY }} -u admin --password-stdin
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
- name: Deploy to Kubernetes
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"

View File

@@ -1,34 +0,0 @@
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
WORKDIR /src
COPY src/FrontOffice.BFF.sln ./
COPY src/FrontOffice.BFF.WebApi/*.csproj ./FrontOffice.BFF.WebApi/
COPY src/FrontOffice.BFF.Application/*.csproj ./FrontOffice.BFF.Application/
COPY src/FrontOffice.BFF.Infrastructure/*.csproj ./FrontOffice.BFF.Infrastructure/
COPY src/FrontOffice.BFF.Domain/*.csproj ./FrontOffice.BFF.Domain/
COPY src/Protobufs/FrontOffice.BFF.Commission.Protobuf/*.csproj ./Protobufs/FrontOffice.BFF.Commission.Protobuf/
COPY src/Protobufs/FrontOffice.BFF.UserWallet.Protobuf/*.csproj ./Protobufs/FrontOffice.BFF.UserWallet.Protobuf/
COPY src/Protobufs/FrontOffice.BFF.User.Protobuf/*.csproj ./Protobufs/FrontOffice.BFF.User.Protobuf/
COPY src/Protobufs/FrontOffice.BFF.DiscountShop.Protobuf/*.csproj ./Protobufs/FrontOffice.BFF.DiscountShop.Protobuf/
COPY src/Protobufs/FrontOffice.BFF.Package.Protobuf/*.csproj ./Protobufs/FrontOffice.BFF.Package.Protobuf/
COPY src/Protobufs/FrontOffice.BFF.ShopingCart.Protobuf/*.csproj ./Protobufs/FrontOffice.BFF.ShopingCart.Protobuf/
COPY src/Protobufs/FrontOffice.BFF.UserOrder.Protobuf/*.csproj ./Protobufs/FrontOffice.BFF.UserOrder.Protobuf/
COPY src/Protobufs/FrontOffice.BFF.ClubMembership.Protobuf/*.csproj ./Protobufs/FrontOffice.BFF.ClubMembership.Protobuf/
COPY src/Protobufs/FrontOffice.BFF.UserAddress.Protobuf/*.csproj ./Protobufs/FrontOffice.BFF.UserAddress.Protobuf/
COPY src/Protobufs/FrontOffice.BFF.Products.Protobuf/*.csproj ./Protobufs/FrontOffice.BFF.Products.Protobuf/
COPY src/Protobufs/FrontOffice.BFF.NetworkMembership.Protobuf/*.csproj ./Protobufs/FrontOffice.BFF.NetworkMembership.Protobuf/
RUN dotnet restore "FrontOffice.BFF.WebApi/FrontOffice.BFF.WebApi.csproj"
COPY src/ ./
RUN dotnet publish "FrontOffice.BFF.WebApi/FrontOffice.BFF.WebApi.csproj" -c Release -o /app/publish --no-restore
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS runtime
WORKDIR /app
COPY --from=build /app/publish .
ENV ASPNETCORE_URLS=http://+:8080
EXPOSE 8080
ENTRYPOINT ["dotnet", "FrontOffice.BFF.WebApi.dll"]