Supports running on docker
This commit is contained in:
@@ -1,25 +0,0 @@
|
|||||||
**/.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
|
|
||||||
@@ -1,21 +1,22 @@
|
|||||||
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
|
#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/sdk:8.0 AS base
|
||||||
#Depending on the operating system of the host machines(s) that will build or run the containers, the image specified in the FROM statement may need to be changed.
|
USER app
|
||||||
#For more information, please see https://aka.ms/containercompat
|
|
||||||
|
|
||||||
FROM mcr.microsoft.com/dotnet/runtime:6.0 AS base
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
#EXPOSE 8080
|
||||||
|
#EXPOSE 8081
|
||||||
|
|
||||||
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
|
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
||||||
|
ARG BUILD_CONFIGURATION=Release
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
COPY ["Hua.DDNS/Hua.DDNS.csproj", "Hua.DDNS/"]
|
COPY ["Hua.DDNS/Hua.DDNS.csproj", "Hua.DDNS/"]
|
||||||
RUN dotnet restore "Hua.DDNS/Hua.DDNS.csproj"
|
RUN dotnet restore "./Hua.DDNS/Hua.DDNS.csproj"
|
||||||
COPY . .
|
COPY . .
|
||||||
WORKDIR "/src/Hua.DDNS"
|
WORKDIR "/src/Hua.DDNS"
|
||||||
RUN dotnet build "Hua.DDNS.csproj" -c Release -o /app/build
|
RUN dotnet build "./Hua.DDNS.csproj" -c $BUILD_CONFIGURATION -o /app/build
|
||||||
|
|
||||||
FROM build AS publish
|
FROM build AS publish
|
||||||
RUN dotnet publish "Hua.DDNS.csproj" -c Release -o /app/publish
|
ARG BUILD_CONFIGURATION=Release
|
||||||
|
RUN dotnet publish "./Hua.DDNS.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=true
|
||||||
|
|
||||||
FROM base AS final
|
FROM base AS final
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|||||||
@@ -4,9 +4,7 @@
|
|||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<PublishSingleFile>true</PublishSingleFile>
|
|
||||||
<UserSecretsId>dotnet-Hua.DDNS-C4DADDFF-6D5B-4BD5-AB11-02F07B517CAC</UserSecretsId>
|
<UserSecretsId>dotnet-Hua.DDNS-C4DADDFF-6D5B-4BD5-AB11-02F07B517CAC</UserSecretsId>
|
||||||
<DockerDefaultTargetOS>Windows</DockerDefaultTargetOS>
|
|
||||||
<SelfContained>true</SelfContained>
|
<SelfContained>true</SelfContained>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|||||||
3
buildImages.ps1
Normal file
3
buildImages.ps1
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
|
||||||
|
cd ./Hua.DDNS
|
||||||
|
docker build -t hua.ddns:latest -f Dockerfile ..
|
||||||
Reference in New Issue
Block a user