From 591004b534c48ead311d512df2d0bee2e30c0532 Mon Sep 17 00:00:00 2001 From: Leandro Cervelin Date: Sat, 13 Jan 2024 00:10:38 -0300 Subject: [PATCH] feat: Updating docker config --- src/CF.Api/CF.Api.csproj | 7 ++----- src/CF.Api/Dockerfile | 5 +---- src/CF.Api/Program.cs | 1 - src/CF.Api/create-database.sql | 2 -- src/CF.Api/docker-compose.yml | 4 +++- src/CF.Api/entrypoint.sh | 16 ---------------- 6 files changed, 6 insertions(+), 29 deletions(-) delete mode 100644 src/CF.Api/create-database.sql delete mode 100644 src/CF.Api/entrypoint.sh diff --git a/src/CF.Api/CF.Api.csproj b/src/CF.Api/CF.Api.csproj index 9d923ba..a0882bc 100644 --- a/src/CF.Api/CF.Api.csproj +++ b/src/CF.Api/CF.Api.csproj @@ -22,17 +22,14 @@ - - + + Always - - Always - \ No newline at end of file diff --git a/src/CF.Api/Dockerfile b/src/CF.Api/Dockerfile index f0efe7a..471e7d3 100644 --- a/src/CF.Api/Dockerfile +++ b/src/CF.Api/Dockerfile @@ -17,7 +17,4 @@ RUN dotnet publish "CF.Api.csproj" -c Release -o /app/publish FROM base AS final WORKDIR /app COPY --from=publish /app/publish . -ENTRYPOINT ["dotnet", "CF.Api.dll"] - -RUN chmod +x ./entrypoint.sh -CMD /bin/bash ./entrypoint.sh \ No newline at end of file +ENTRYPOINT ["dotnet", "CF.Api.dll"] \ No newline at end of file diff --git a/src/CF.Api/Program.cs b/src/CF.Api/Program.cs index c27769c..4899246 100644 --- a/src/CF.Api/Program.cs +++ b/src/CF.Api/Program.cs @@ -66,7 +66,6 @@ void AddExceptionHandler() void AddSwagger() { - if (!app.Environment.IsDevelopment()) return; app.UseSwagger(); app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "CF Api")); } diff --git a/src/CF.Api/create-database.sql b/src/CF.Api/create-database.sql deleted file mode 100644 index 5b0c788..0000000 --- a/src/CF.Api/create-database.sql +++ /dev/null @@ -1,2 +0,0 @@ -CREATE DATABASE CF -GO \ No newline at end of file diff --git a/src/CF.Api/docker-compose.yml b/src/CF.Api/docker-compose.yml index b0c8d4c..7685926 100644 --- a/src/CF.Api/docker-compose.yml +++ b/src/CF.Api/docker-compose.yml @@ -1,4 +1,4 @@ -version: "3" +version: "3.4" services: api: build: @@ -6,6 +6,8 @@ services: dockerfile: CF.Api/Dockerfile ports: - "8888:80" + environment: + - ASPNETCORE_URLS=http://+:80 depends_on: - db db: diff --git a/src/CF.Api/entrypoint.sh b/src/CF.Api/entrypoint.sh deleted file mode 100644 index d175016..0000000 --- a/src/CF.Api/entrypoint.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -set -e -run_cmd="dotnet run --server.urls http://*:80" - -until dotnet ef database update; do ->&2 echo "SQL Server is starting up" -sleep 1 -done - ->&2 echo "SQL Server is up - executing command" -exec $run_cmd -sleep 10 - ->&2 echo "Creating Database" -/opt/mssql-tools/bin/sqlcmd -S db -U sa -P CF@!1234FC6549 -i create-database.sql \ No newline at end of file