From 1d70796d70641e76b7f74a6da61962b9ff63c281 Mon Sep 17 00:00:00 2001 From: Mia Winter Date: Fri, 17 Nov 2023 22:08:03 +0100 Subject: [PATCH] changed: migrated project to .NET 8, port changed to 8080 --- .dockerignore | 7 ++++++- Dockerfile | 15 +++++++++------ JustShortIt.csproj | 8 ++++---- Properties/launchSettings.json | 6 ++++-- README.md | 1 + 5 files changed, 24 insertions(+), 13 deletions(-) diff --git a/.dockerignore b/.dockerignore index 3729ff0..fe1152b 100644 --- a/.dockerignore +++ b/.dockerignore @@ -22,4 +22,9 @@ **/secrets.dev.yaml **/values.dev.yaml LICENSE -README.md \ No newline at end of file +README.md +!**/.gitignore +!.git/HEAD +!.git/config +!.git/packed-refs +!.git/refs/heads/** \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 6d65a4e..712231c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,19 +1,22 @@ #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:7.0 AS base +FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base +USER app WORKDIR /app -EXPOSE 80 +EXPOSE 8080 -FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build +FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build +ARG BUILD_CONFIGURATION=Release WORKDIR /src COPY ["JustShortIt.csproj", "."] -RUN dotnet restore "./JustShortIt.csproj" +RUN dotnet restore "./././JustShortIt.csproj" COPY . . WORKDIR "/src/." -RUN dotnet build "JustShortIt.csproj" -c Release -o /app/build +RUN dotnet build "./JustShortIt.csproj" -c $BUILD_CONFIGURATION -o /app/build FROM build AS publish -RUN dotnet publish "JustShortIt.csproj" -c Release -o /app/publish /p:UseAppHost=false +ARG BUILD_CONFIGURATION=Release +RUN dotnet publish "./JustShortIt.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false FROM base AS final WORKDIR /app diff --git a/JustShortIt.csproj b/JustShortIt.csproj index fa7eccd..7d30a33 100644 --- a/JustShortIt.csproj +++ b/JustShortIt.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 enable enable Linux @@ -17,9 +17,9 @@ - - - + + + diff --git a/Properties/launchSettings.json b/Properties/launchSettings.json index 9ba6121..25632c8 100644 --- a/Properties/launchSettings.json +++ b/Properties/launchSettings.json @@ -7,7 +7,7 @@ "ASPNETCORE_ENVIRONMENT": "Development" }, "dotnetRunMessages": true, - "applicationUrl": "http://localhost:5128" + "applicationUrl": "http://localhost:8080" }, "IIS Express": { "commandName": "IISExpress", @@ -18,8 +18,10 @@ }, "Docker": { "commandName": "Docker", - "launchBrowser": true, "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}", + "environmentVariables": { + "ASPNETCORE_HTTP_PORTS": "8080" + }, "publishAllPorts": true } }, diff --git a/README.md b/README.md index dc0d684..9ead387 100644 --- a/README.md +++ b/README.md @@ -92,6 +92,7 @@ services: - "JSI_Redis__ConnectionString=redis,password=" environment: - "VIRTUAL_HOST=" + - "VIRTUAL_PORT=8080" - "LETSENCRYPT_HOST=" depends_on: - redis