Dockerfile и http
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-10-05 16:46:47 +03:00
parent 4e30f3e7a5
commit 81a01ae4ed
5 changed files with 40 additions and 4 deletions

2
.gitignore vendored
View File

@@ -33,3 +33,5 @@ _UpgradeReport_Files/
Thumbs.db
Desktop.ini
.DS_Store
.env

36
Docker/docker-compose.yml Normal file
View File

@@ -0,0 +1,36 @@
services:
api:
image: prtsie/schengen-visa
container_name: visa-api
ports:
- "5000:5000"
depends_on:
postgres-db:
condition: service_healthy
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ConnectionStrings__connectionString=Host=postgres-db;Port=5432;Database=visa;Username=postgres;Password=Qwerty123456!
networks:
- app-network
restart: on-failure
postgres-db:
image: postgres:latest
container_name: visa-db
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: ${POSTGRESPASS}
ports:
- "5432:5432"
networks:
- app-network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d auth"]
interval: 5s
timeout: 5s
retries: 10
start_period: 10s
networks:
app-network:
driver: bridge

View File

@@ -7,6 +7,6 @@ RUN dotnet publish "SchengenVisaApi/SchengenVisaApi.csproj" -c Release -o /app/p
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
WORKDIR /app
COPY --from=build /app/publish ./
ENV ASPNETCORE_URLS=https://*:5000
ENV ASPNETCORE_URLS=http://*:5000
EXPOSE 5000
ENTRYPOINT ["dotnet", "SchengenVisaApi.dll"]

View File

@@ -24,7 +24,7 @@ public class Program
private static async Task HandleMigrationKey(string[] args, WebApplication app)
{
if (args.Contains(MigrationKey))
if (true)
{
using var scope = app.Services.CreateScope();
await using var context = scope.ServiceProvider.GetRequiredService<DatabaseContext>();

View File

@@ -9,8 +9,6 @@ public static class PipelineRequest
app.UseSwagger()
.UseSwaggerUI();
app.UseHttpsRedirection();
app.UseStatusCodePages();
app.UseCors("policy");