Skip to content

Commit 5e4d3c1

Browse files
committed
feat: updated docker file to have ef tools
1 parent c850909 commit 5e4d3c1

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ WORKDIR /src
55
COPY *.csproj ./
66
RUN dotnet restore
77

8+
# Install EF tools
9+
RUN dotnet tool install --global dotnet-ef
10+
ENV PATH="$PATH:/root/.dotnet/tools"
11+
812
# Copy everything else and build
913
COPY . ./
1014
RUN dotnet publish -c Release -o /app

Program.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,10 @@
123123

124124
using (var scope = app.Services.CreateScope())
125125
{
126-
var services = scope.ServiceProvider;
127-
var seeder = services.GetRequiredService<IdentitySeeder>();
126+
var db = scope.ServiceProvider.GetRequiredService<ApplicationDbContext>();
127+
db.Database.Migrate(); // This applies pending migrations automatically
128+
129+
var seeder = scope.ServiceProvider.GetRequiredService<IdentitySeeder>();
128130
await seeder.SeedAsync();
129131
}
130132

appsettings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"ConnectionStrings": {
3-
"DefaultConnection": "Host=admin-hub-api:europe-west9:adminhub-db;Database=adminhub;Username=postgres;Password=&,~/Yhr@&G<Ker}+"
3+
"DefaultConnection": "Host=34.155.97.182;Database=adminhub;Username=postgres;Password=&,~/Yhr@&G<Ker}+"
44
},
55
"Logging": {
66
"LogLevel": {

0 commit comments

Comments
 (0)