Add Docker Support

Co-authored-by: Robert Paciorek <robert@opcode.eu.org>
This commit is contained in:
Alan Moon 2023-10-01 10:14:24 -07:00 committed by Robert Paciorek
parent 9089ea786d
commit cadf9dd977
3 changed files with 63 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

18
docker-compose.yml Normal file
View File

@ -0,0 +1,18 @@
version: '3.8'
services:
sodoff:
build:
context: .
dockerfile: src/Dockerfile
# ports:
# - 5000:5000
networks:
sodoff_network:
ipv4_address: 172.16.99.10
networks:
sodoff_network:
driver: bridge
ipam:
config:
- subnet: "172.16.99.0/24"

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/aspnet:6.0 AS base
WORKDIR /app
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["src/sodoff.csproj", "src/"]
RUN dotnet restore "src/sodoff.csproj"
COPY . .
WORKDIR "/src/src"
RUN dotnet build "sodoff.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "sodoff.csproj" -c Release -o /app/publish /p:UseAppHost=false
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "sodoff.dll"]