Refactor database update job and update connection string in docker-compose for consistency #5

This commit is contained in:
Marek Lesko
2025-07-28 10:50:11 +00:00
parent e35fe1bf6c
commit 14c3307339
2 changed files with 13 additions and 13 deletions

View File

@@ -43,18 +43,6 @@ semantic-release:
only:
- main
update_db:
image: mcr.microsoft.com/dotnet/sdk:8.0
stage: release
script:
- dotnet restore
- dotnet build
- dotnet ef database update --project Api/Api.csproj --startup-project Api/Api.csproj
variables:
ConnectionStrings__DefaultConnection: "Server=db;Database=CentrumDb;User=sa;Password=Your_password123;TrustServerCertificate=True;"
only:
- main
docker-build:
stage: build
image: docker:latest
@@ -85,3 +73,15 @@ docker-deploy:
- docker compose pull
- docker compose -f docker-compose.yaml up -d
- docker image prune -f -a
update_db:
image: mcr.microsoft.com/dotnet/sdk:8.0
stage: release
script:
- dotnet restore
- dotnet build
- dotnet ef database update --project Api/Api.csproj --startup-project Api/Api.csproj
tags:
- production
variables:
ConnectionStrings__DefaultConnection: "Server=localhost;Database=CentrumDb;User=sa;Password=$DB_PASSWORD;TrustServerCertificate=True;"

View File

@@ -8,7 +8,7 @@ services:
restart: unless-stopped
environment:
- ASPNETCORE_ENVIRONMENT=Production
- ConnectionStrings__DefaultConnection=Server=localhost;Database=centrum;User Id=sa;Password=$DB_PASSWORD;TrustServerCertificate=True;
- ConnectionStrings__DefaultConnection=Server=localhost;Database=CentrumDb;User Id=sa;Password=$DB_PASSWORD;TrustServerCertificate=True;
network_mode: host
db: