artify / Dockerfile
Mohammed Foud
first commit
3cda1f6
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@@@@"