diff --git a/.gitea/workflows/kub-deploy.yml b/.gitea/workflows/kub-deploy.yml index b72ba65..802a602 100644 --- a/.gitea/workflows/kub-deploy.yml +++ b/.gitea/workflows/kub-deploy.yml @@ -15,27 +15,38 @@ jobs: 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 git - run: | - export http_proxy=http://proxyuser:87zH26nbqT2@46.249.98.211:3128 - export https_proxy=http://proxyuser:87zH26nbqT2@46.249.98.211:3128 - apk add --no-cache git - - - name: Checkout code - run: | - git clone --depth 1 --branch kub-stage http://gitea-svc:3000/admin/BackOffice.git . - git log -1 --format="%H %s" + run: apk add --no-cache git + + - name: Clone repo + run: | + git clone --depth 1 --branch kub-stage http://gitea-svc:3000/admin/BackOffice.git . - name: Start Docker daemon with insecure registry run: | mkdir -p /etc/docker - cat > /etc/docker/daemon.json << 'DOCKER_EOF' + cat > /etc/docker/daemon.json << 'DAEMON' { - "insecure-registries": ["gitea-svc:3000"] + "insecure-registries": ["194.5.195.53:30080", "gitea-svc:3000"] } - DOCKER_EOF - + 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 @@ -44,8 +55,9 @@ jobs: - name: Build Docker Image run: | - cd src/BackOffice - docker build -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} \ + cd src + docker build -f BackOffice/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 \ diff --git a/src/.dockerignore b/src/.dockerignore new file mode 100644 index 0000000..cd967fc --- /dev/null +++ b/src/.dockerignore @@ -0,0 +1,25 @@ +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/.idea +**/*.*proj.user +**/*.dbmdl +**/*.jfm +**/azds.yaml +**/bin +**/charts +**/docker-compose* +**/Dockerfile* +**/node_modules +**/npm-debug.log +**/obj +**/secrets.dev.yaml +**/values.dev.yaml +LICENSE +README.md \ No newline at end of file diff --git a/src/BackOffice/BackOffice.csproj b/src/BackOffice/BackOffice.csproj index 69f9865..2ba3cf8 100644 --- a/src/BackOffice/BackOffice.csproj +++ b/src/BackOffice/BackOffice.csproj @@ -8,11 +8,15 @@ false false false + Linux + + .dockerignore + diff --git a/src/BackOffice/Dockerfile b/src/BackOffice/Dockerfile new file mode 100644 index 0000000..65b29ff --- /dev/null +++ b/src/BackOffice/Dockerfile @@ -0,0 +1,24 @@ +FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base +USER $APP_UID +WORKDIR /app +EXPOSE 8080 +EXPOSE 8081 + +FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build +ARG BUILD_CONFIGURATION=Release +WORKDIR /src +COPY ["BackOffice/NuGet.config", "NuGet.config"] +COPY ["BackOffice/BackOffice.csproj", "BackOffice/"] +RUN dotnet restore "BackOffice/BackOffice.csproj" --configfile NuGet.config +COPY . . +WORKDIR "/src/BackOffice" +RUN dotnet build "./BackOffice.csproj" -c $BUILD_CONFIGURATION -o /app/build + +FROM build AS publish +ARG BUILD_CONFIGURATION=Release +RUN dotnet publish "./BackOffice.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "BackOffice.dll"] diff --git a/src/BackOffice/NuGet.config b/src/BackOffice/NuGet.config new file mode 100644 index 0000000..81da29b --- /dev/null +++ b/src/BackOffice/NuGet.config @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/BackOffice/wwwroot/appsettings.json b/src/BackOffice/wwwroot/appsettings.json index 7b627c4..51dab4b 100644 --- a/src/BackOffice/wwwroot/appsettings.json +++ b/src/BackOffice/wwwroot/appsettings.json @@ -1,6 +1,6 @@ { // "GwUrl": "https://bogw.kbs1.ir", - "GwUrl": "https://localhost:6468", + "GwUrl": "http://backoffice-bff-svc", "Authentication": { //"Authority": "https://localhost:5001", "Authority": "https://ids.afrino.co/",