File size: 2,210 Bytes
8edbc20
 
2e762cf
8edbc20
2e762cf
7dc43ad
bc8c658
8edbc20
 
48981b3
 
 
 
 
d9d0536
cc3c77c
d74eb5e
ac6e7d9
ebc977e
8edbc20
 
 
 
 
d9d0536
824369f
59a53c5
d9d0536
 
 
7dc43ad
bc8c658
 
 
d9d0536
24023a5
1cf12b8
8edbc20
 
 
 
 
 
 
 
dd77293
 
d9d0536
dd77293
 
 
 
 
 
 
 
 
 
 
 
d9d0536
dd77293
 
 
d9d0536
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
WORKDIR /app
EXPOSE 7860

ENV ASPNETCORE_URLS=http://0.0.0.0:7860
ENV ConnectionStrings__DefaultConnection="Host=aws-0-eu-central-1.pooler.supabase.com;Port=5432;Database=postgres;Username=postgres.hpbtdersdvvpxrkmhbfe;Password=009988Ppooii@@@@"
ENV JWT__KEY="YourSecretKey123!@#$%^&*()+=-0987654321"
ENV JWT__ISSUER="your-issuer"
ENV JWT__AUDIENCE="your-audience"
ENV DB_HOST="aws-0-eu-central-1.pooler.supabase.com"
ENV DB_PORT="5432"
ENV DB_NAME="postgres"
ENV DB_USER="postgres.hpbtdersdvvpxrkmhbfe"
ENV DB_PASSWORD="009988Ppooii@@@@"





FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src
COPY ["Backend.csproj", "./"]
RUN dotnet restore "Backend.csproj"
COPY . .



# Install EF Core tools
RUN dotnet tool install --global dotnet-ef
ENV PATH="${PATH}:/root/.dotnet/tools"
ENV ConnectionStrings__DefaultConnection="Host=aws-0-eu-central-1.pooler.supabase.com;Port=5432;Database=postgres;Username=postgres.hpbtdersdvvpxrkmhbfe;Password=009988Ppooii@@@@"
ENV JWT__KEY="YourSecretKey123!@#$%^&*()+=-0987654321"
ENV JWT__ISSUER="your-issuer"
ENV JWT__AUDIENCE="your-audience"
# Create migrations
RUN dotnet ef migrations add InitialMigration --project Backend.csproj
# RUN dotnet ef database update 
RUN dotnet build "Backend.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "Backend.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .

# Copy migrations from build stage
COPY --from=build /src/Migrations ./Migrations
COPY --from=build /src/*.db ./

# Create and run the entrypoint script
COPY <<EOF /app/entrypoint.sh
#!/bin/sh
set -e

# Wait for a brief moment to ensure database is ready
sleep 5

# Apply migrations
dotnet Backend.dll migrate

# Start the application
dotnet Backend.dll
EOF

RUN chmod +x /app/entrypoint.sh

ENTRYPOINT ["/app/entrypoint.sh"]

# User Id=postgres.hpbtdersdvvpxrkmhbfe;Password=[YOUR-PASSWORD];Server=aws-0-eu-central-1.pooler.supabase.com;Port=5432;Database=postgres;
# ENV ConnectionStrings__Local="Host=aws-0-eu-central-1.pooler.supabase.com;Port=6543;Database=postgres;Username=postgres.xergfpyauvdbavdyzzbk;Password=009988Ppooii@@@@"