Skip to content

Commit

Permalink
Merge pull request #9 from fossapps/hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberhck authored Sep 8, 2019
2 parents f3c0848 + 1e84b9b commit 8bf8488
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
- echo "$DOCKERHUB_PASSWORD" | docker login --username "$DOCKERHUB_LOGIN" --password-stdin
- docker build . -t fossapps/micro.starter --build-arg VERSION=$TAG
- docker-compose -f ./docker-compose.ci.yml up -d
# - docker run --rm -v `pwd`:/app mcr.microsoft.com/dotnet/core/sdk:3.0.100-preview8-alpine3.9 sh -c "cd /app; dotnet ef database update --project ./Micro.Starter.Api/Micro.Starter.Api.csproj"
- sh ./Micro.Starter.UnitTest/ExternalTests/postman_tests.sh
- docker tag fossapps/micro.starter fossapps/micro.starter:$TAG
- docker push fossapps/micro.starter:$TAG
Expand Down
3 changes: 3 additions & 0 deletions Micro.Starter.Api/Micro.Starter.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@
<None Include="./appsettings.ci.json" CopyToPublishDirectory="Always" />
</ItemGroup>

<Target Name="Install githooks" BeforeTargets="Build">
<Exec Command="cp ../hooks/* ../.git/hooks/" />
</Target>
</Project>
10 changes: 9 additions & 1 deletion Micro.Starter.Api/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
using App.Metrics.AspNetCore;
using App.Metrics.Extensions.Configuration;
using App.Metrics.Formatters.InfluxDB;
using Micro.Starter.Api.Models;
using Microsoft.AspNetCore.Hosting;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;

namespace Micro.Starter.Api
Expand All @@ -13,7 +16,12 @@ public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
var host = CreateHostBuilder(args).Build();
using (var scope = host.Services.CreateScope())
{
scope.ServiceProvider.GetRequiredService<ApplicationContext>().Database.Migrate();
}
host.Run();
}

public static IHostBuilder CreateHostBuilder(string[] args) =>
Expand Down
2 changes: 2 additions & 0 deletions docker-compose.ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ version: '3'
services:
api:
image: fossapps/micro.starter
depends_on:
- postgres
ports:
- 5000:5000
environment:
Expand Down

0 comments on commit 8bf8488

Please sign in to comment.