Add Basic Docker Support (#1)

* Add Basic Docker Support

* Docker: forward port 9933

---------

Co-authored-by: Spirtix <michal.prazak1@gmail.com>
This commit is contained in:
Alan Moon 2023-09-04 11:24:39 -07:00 committed by GitHub
parent af5007e3b7
commit 68e0f7a723
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 48 additions and 0 deletions

25
.dockerignore Normal file
View File

@ -0,0 +1,25 @@
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/azds.yaml
**/bin
**/charts
**/docker-compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md

20
src/Dockerfile Normal file
View File

@ -0,0 +1,20 @@
#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
FROM mcr.microsoft.com/dotnet/runtime:6.0 AS base
WORKDIR /app
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["src/sodoffmmo.csproj", "src/"]
RUN dotnet restore "src/sodoffmmo.csproj"
COPY . .
WORKDIR "/src/src"
RUN dotnet build "sodoffmmo.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "sodoffmmo.csproj" -c Release -o /app/publish /p:UseAppHost=false
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "sodoffmmo.dll"]

View File

@ -5,10 +5,13 @@
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerfileRunArguments>-p 9933:9933</DockerfileRunArguments>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ComponentAce.Compression.Libs.zlib" Version="1.0.4" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.4" />
</ItemGroup>
</Project>