Skip to content
Snippets Groups Projects
Commit 002879e4 authored by Fillip Vikter Fontao Danelund's avatar Fillip Vikter Fontao Danelund
Browse files

Merge branch 'efcoresetup' into 'main'

initial efcore solution + dockerfile

See merge request !1
parents 8bbb4662 0f5c5d7f
No related branches found
No related tags found
1 merge request!1initial efcore solution + dockerfile
Pipeline #374242 passed
using Microsoft.EntityFrameworkCore;
namespace DnDSpilleplade.API.Data
{
public class AppDbContext : DbContext
{
public AppDbContext(DbContextOptions<AppDbContext> options) : base(options)
{
}
}
}
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.3" />
</ItemGroup>
</Project>
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");
version: '3.9'
services:
api:
build:
context: .
dockerfile: DnDSpilleplade.API/Dockerfile
ports:
- "5000:80"
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ConnectionStrings__DefaultConnection=Server=sqlserver;Database=DnDDB;User=sa;Password=Your_password123;
depends_on:
- sqlserver
sqlserver:
image: mcr.microsoft.com/mssql/server:2022-latest
environment:
SA_PASSWORD: "Your_password123"
ACCEPT_EULA: "Y"
ports:
- "1433:1433"
# Use the official .NET 9 SDK image to build the app
FROM mcr.microsoft.com/dotnet/sdk:9.0-preview AS build
WORKDIR /app
# Copy solution and project files
COPY *.sln .
COPY DnDSpilleplade.API/*.csproj ./DnDSpilleplade.API/
COPY DnDSpilleplade.Data/*.csproj ./DnDSpilleplade.Data/
RUN dotnet restore
# Copy the rest of the source code
COPY . .
WORKDIR /app/DnDSpilleplade.API
RUN dotnet publish -c Release -o out
# Runtime image (ASP.NET Core 9 preview)
FROM mcr.microsoft.com/dotnet/aspnet:9.0-preview
WORKDIR /app
COPY --from=build /app/DnDSpilleplade.API/out ./
ENTRYPOINT ["dotnet", "DnDSpilleplade.API.dll"]
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.2.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DnDBattlefield", "DnDBattlefield\DnDBattlefield.csproj", "{7339DEAA-3CFC-DC3F-4E87-8A8EF05B6965}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7339DEAA-3CFC-DC3F-4E87-8A8EF05B6965}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7339DEAA-3CFC-DC3F-4E87-8A8EF05B6965}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7339DEAA-3CFC-DC3F-4E87-8A8EF05B6965}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7339DEAA-3CFC-DC3F-4E87-8A8EF05B6965}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {CD890992-A0AD-4A6B-93FB-11B6B3DD0BB2}
EndGlobalSection
EndGlobal
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment