chore: تنظیم Nexus برای NuGet و Docker offline
Build and Deploy to Kubernetes / build (push) Failing after 1m4s
Build and Deploy to Kubernetes / build (push) Failing after 1m4s
- Dockerfile: استفاده از Nexus Docker (194.5.195.53:32082) - NuGet.config: استفاده از Nexus NuGet با HTTP و allowInsecureConnections - workflow: حذف kubectl dependency، اضافه کردن 32082 به insecure-registries - csproj: تغییر push آدرس به Nexus foursat-nuget-hosted
This commit is contained in:
@@ -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 }}"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user