Skip to content

Commit

Permalink
Fix server logs.
Browse files Browse the repository at this point in the history
  • Loading branch information
bitbound committed Feb 21, 2024
1 parent f2d0ca6 commit c2d53db
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 43 deletions.
3 changes: 2 additions & 1 deletion .azure-pipelines/Release Build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ jobs:
targetType: inline
script: |
Copy-Item -Path "$(Build.SourcesDirectory)\Server\Dockerfile" -Destination "$(build.artifactstagingdirectory)\Dockerfile"
Copy-Item -Path "$(Build.SourcesDirectory)\Server\DockerMain.sh" -Destination "$(build.artifactstagingdirectory)\DockerMain.sh"
Copy-Item -Path "$(Build.SourcesDirectory)\docker-compose\docker-compose.yml" -Destination "$(build.artifactstagingdirectory)\docker-compose.yml"
Copy-Item -Path "$(Build.SourcesDirectory)\docker-compose\docker-compose-compat.yml" -Destination "$(build.artifactstagingdirectory)\docker-compose-compat.yml"
- task: PublishBuildArtifacts@1
displayName: Publish Artifact
Expand Down
26 changes: 2 additions & 24 deletions Server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,36 +1,14 @@
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
FROM mcr.microsoft.com/dotnet/aspnet:8.0

EXPOSE ${ASPNETCORE_HTTP_PORTS}
EXPOSE ${ASPNETCORE_HTTPS_PORTS}

RUN apt -y update && apt -y install curl
RUN mkdir -p /app/AppData
RUN chown app:app -R /app/AppData

WORKDIR /app

FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["Directory.Build.props", "."]
COPY ["Server/Server.csproj", "Server/"]
COPY ["Shared/Shared.csproj", "Shared/"]
COPY ["submodules/Immense.RemoteControl/Immense.RemoteControl.Shared/Immense.RemoteControl.Shared.csproj", "submodules/Immense.RemoteControl/Immense.RemoteControl.Shared/"]
COPY ["submodules/Immense.RemoteControl/Immense.RemoteControl.Server/Immense.RemoteControl.Server.csproj", "submodules/Immense.RemoteControl/Immense.RemoteControl.Server/"]
RUN dotnet restore "./Server/./Server.csproj"
COPY . .
WORKDIR "/src/Server"

RUN dotnet build "./Server.csproj" -c $BUILD_CONFIGURATION -o /app/build

FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./Server.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false

COPY Server/bin/publish /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .

USER app
ENTRYPOINT ["dotnet", "Remotely_Server.dll"]
Expand Down
1 change: 0 additions & 1 deletion Server/Dockerfile.pipelines
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
FROM mcr.microsoft.com/dotnet/aspnet:8.0

EXPOSE ${ASPNETCORE_HTTP_PORTS}
EXPOSE ${ASPNETCORE_HTTPS_PORTS}

RUN apt -y update && apt -y install curl
RUN mkdir -p /app/AppData
Expand Down
10 changes: 5 additions & 5 deletions Server/Services/LogsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ public static string DefaultLogsDirectory
{
get
{
var logsDir = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "logs");
if (Directory.Exists("/remotely-data"))
{
logsDir = "/remotely-data/logs";
}
var logsDir = Path.Combine(
AppDomain.CurrentDomain.BaseDirectory,
"AppData",
"logs");

return logsDir;
}
}
Expand Down
2 changes: 0 additions & 2 deletions docker-compose/docker-compose-compat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@ services:
dockerfile: Server/Dockerfile
ports:
- "5000:5000"
- "5001:5001"
environment:
- ASPNETCORE_ENVIRONMENT=Production
- ASPNETCORE_HTTP_PORTS=5000
- ASPNETCORE_HTTPS_PORTS=5001
# Other ASP.NET Core configurations can be overridden here, such as Logging.
# See https://learn.microsoft.com/en-us/aspnet/core/fundamentals/configuration/?view=aspnetcore-8.0

Expand Down
9 changes: 4 additions & 5 deletions docker-compose/docker-compose.override.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
version: '3.4'

volumes:
remotely-data:
name: remotely-data


services:
remotely:
Expand All @@ -16,4 +12,7 @@ services:
- "5001:5001"
volumes:
- ${APPDATA}/Microsoft/UserSecrets:/home/app/.microsoft/usersecrets:ro
- ${APPDATA}/ASP.NET/Https:/home/app/.aspnet/https:ro
- ${APPDATA}/ASP.NET/Https:/home/app/.aspnet/https:ro
build:
context: ../
dockerfile: Server/Dockerfile
5 changes: 0 additions & 5 deletions docker-compose/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,11 @@ services:
image: immybot/remotely:latest
volumes:
- remotely-data:/app/AppData
build:
context: ../
dockerfile: Server/Dockerfile
ports:
- "5000:5000"
- "5001:5001"
environment:
- ASPNETCORE_ENVIRONMENT=Production
- ASPNETCORE_HTTP_PORTS=5000
- ASPNETCORE_HTTPS_PORTS=5001
# Other ASP.NET Core configurations can be overridden here, such as Logging.
# See https://learn.microsoft.com/en-us/aspnet/core/fundamentals/configuration/?view=aspnetcore-8.0

Expand Down

0 comments on commit c2d53db

Please sign in to comment.