Docker file

This commit is contained in:
Karolis2011
2019-06-19 00:01:58 +03:00
parent 8de5e47783
commit 4125545257
5 changed files with 60 additions and 4 deletions

20
.dockerignore Normal file
View File

@@ -0,0 +1,20 @@
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.vs
**/.vscode
**/*.*proj.user
**/azds.yaml
**/charts
**/bin
**/obj
**/Dockerfile
**/Dockerfile.develop
**/docker-compose.yml
**/docker-compose.*.yml
**/*.dbmdl
**/*.jfm
**/secrets.dev.yaml
**/values.dev.yaml
**/.toolstarget

18
EventBot/Dockerfile Normal file
View File

@@ -0,0 +1,18 @@
FROM mcr.microsoft.com/dotnet/core/runtime:2.2-stretch-slim AS base
WORKDIR /app
FROM mcr.microsoft.com/dotnet/core/sdk:2.2-stretch AS build
WORKDIR /src
COPY ["EventBot/EventBot.csproj", "EventBot/"]
RUN dotnet restore "EventBot/EventBot.csproj"
COPY . .
WORKDIR "/src/EventBot"
RUN dotnet build "EventBot.csproj" -c Release -o /app
FROM build AS publish
RUN dotnet publish "EventBot.csproj" -c Release -o /app
FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "EventBot.dll"]

View File

@@ -3,12 +3,9 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.2</TargetFramework>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>
<ItemGroup>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Discord.Addons.Interactive" Version="1.0.1" />
<PackageReference Include="Discord.Net" Version="2.1.1" />
@@ -20,6 +17,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.7.9" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="2.2.0" />
</ItemGroup>

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PublishProtocol>FileSystem</PublishProtocol>
<Configuration>Release</Configuration>
<Platform>Any CPU</Platform>
<TargetFramework>netcoreapp2.2</TargetFramework>
<PublishDir>bin\Release\netcoreapp2.2\publish\linux-arm</PublishDir>
<RuntimeIdentifier>linux-arm</RuntimeIdentifier>
<SelfContained>true</SelfContained>
<_IsPortable>false</_IsPortable>
</PropertyGroup>
</Project>

View File

@@ -3,8 +3,12 @@
"EventBot": {
"commandName": "Project",
"environmentVariables": {
"dbconnection": "Server=localhost;Database=eventbot;User=root;Password=tux;",
"token": "<insert Token here>"
}
},
"Docker": {
"commandName": "Docker"
}
}
}