diff --git a/.github/workflows/deploy-gcloud.yml b/.github/workflows/deploy-gcloud.yml index 0f36b6e..1f0d445 100644 --- a/.github/workflows/deploy-gcloud.yml +++ b/.github/workflows/deploy-gcloud.yml @@ -95,6 +95,30 @@ jobs: docker push ${{ env.REMOTE_IMAGE }} docker push ${{ env.REMOTE_IMAGE_LATEST }} + # - name: Deploy to Cloud Run (Production) + # if: github.ref == 'refs/heads/main' && github.event_name == 'push' + # run: | + # gcloud run deploy ${{ env.SERVICE_NAME }} \ + # --image ${{ env.REMOTE_IMAGE }} \ + # --platform managed \ + # --region ${{ env.REGION }} \ + # --allow-unauthenticated \ + # --memory 4Gi \ + # --cpu 2 \ + # --max-instances 10 \ + # --min-instances 0 \ + # --set-env-vars "ASPNETCORE_ENVIRONMENT=Production,ASPNETCORE_URLS=http://+:10000" \ + # --set-env-vars "ConnectionStrings__DefaultConnection=${{ secrets.DB_CONNECTION_STRING }}" \ + # --set-env-vars "AppSettings__BaseUrl=${{ vars.BASE_URL }}" \ + # --set-env-vars "Email__Enabled=true" \ + # --set-env-vars "Email__FromEmail=${{ secrets.FROM_EMAIL }}" \ + # --set-env-vars "Email__FromName=Legal Assistant" \ + # --set-env-vars "Email__SmtpHost=${{ vars.SMTP_HOST }}" \ + # --set-env-vars "Email__SmtpPort=${{ vars.SMTP_PORT }}" \ + # --set-env-vars "Email__SmtpUsername=${{ secrets.SMTP_USERNAME }}" \ + # --set-env-vars "Email__SmtpPassword=${{ secrets.SMTP_PASSWORD }}" \ + # --quiet + - name: Deploy to Cloud Run (Production) if: github.ref == 'refs/heads/main' && github.event_name == 'push' run: | @@ -107,8 +131,7 @@ jobs: --cpu 2 \ --max-instances 10 \ --min-instances 0 \ - --port ${{ env.PORT }} \ - --set-env-vars "ASPNETCORE_ENVIRONMENT=Production" \ + --set-env-vars "ASPNETCORE_ENVIRONMENT=Production,ASPNETCORE_URLS=http://+:10000" \ --quiet - name: Deploy to Cloud Run (Staging) @@ -123,8 +146,7 @@ jobs: --cpu 2 \ --max-instances 5 \ --min-instances 0 \ - --port ${{ env.PORT }} \ - --set-env-vars "ASPNETCORE_ENVIRONMENT=Staging" \ + --set-env-vars "ASPNETCORE_ENVIRONMENT=Staging,ASPNETCORE_URLS=http://+:10000" \ --quiet - name: Output deployment info diff --git a/src/Web.Api/Dockerfile b/src/Web.Api/Dockerfile index fa5a7f9..fd667bc 100644 --- a/src/Web.Api/Dockerfile +++ b/src/Web.Api/Dockerfile @@ -2,8 +2,6 @@ FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base USER app WORKDIR /app -EXPOSE 8080 -EXPOSE 8081 FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build ARG BUILD_CONFIGURATION=Release @@ -25,4 +23,5 @@ RUN dotnet publish "./Web.Api.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p FROM base AS final WORKDIR /app COPY --from=publish /app/publish . + ENTRYPOINT ["dotnet", "Web.Api.dll"] \ No newline at end of file diff --git a/src/Web.Api/appsettings.Production.json b/src/Web.Api/appsettings.Production.json index bd32633..40c80e1 100644 --- a/src/Web.Api/appsettings.Production.json +++ b/src/Web.Api/appsettings.Production.json @@ -9,7 +9,7 @@ "DefaultConnection": "Host=69.164.244.36;Database=law_chatbot;Username=postgres;Password=Admin@123;Port=5555" }, "AppSettings": { - "BaseUrl": "http://localhost:10000" + "BaseUrl": "https://legal-assistant-api-900984203976.asia-southeast1.run.app" }, "Email": { "Enabled": true,