update
This commit is contained in:
parent
d4af3b8707
commit
f1a7be15f2
66
.dockerignore
Normal file
66
.dockerignore
Normal file
|
|
@ -0,0 +1,66 @@
|
||||||
|
# Build artifacts
|
||||||
|
**/bin/
|
||||||
|
**/obj/
|
||||||
|
**/out/
|
||||||
|
|
||||||
|
# Visual Studio files
|
||||||
|
**/.vs/
|
||||||
|
**/.vscode/
|
||||||
|
**/*.user
|
||||||
|
**/*.suo
|
||||||
|
**/*.userosscache
|
||||||
|
**/*.sln.docstates
|
||||||
|
|
||||||
|
# User-specific files
|
||||||
|
**/.user
|
||||||
|
**/.suo
|
||||||
|
**/.userosscache
|
||||||
|
|
||||||
|
# Build results
|
||||||
|
[Dd]ebug/
|
||||||
|
[Dd]ebugPublic/
|
||||||
|
[Rr]elease/
|
||||||
|
[Rr]eleases/
|
||||||
|
x64/
|
||||||
|
x86/
|
||||||
|
[Aa][Rr][Mm]/
|
||||||
|
[Aa][Rr][Mm]64/
|
||||||
|
bld/
|
||||||
|
[Bb]in/
|
||||||
|
[Oo]bj/
|
||||||
|
[Ll]og/
|
||||||
|
[Ll]ogs/
|
||||||
|
|
||||||
|
# NuGet packages
|
||||||
|
**/packages/
|
||||||
|
**/*.nupkg
|
||||||
|
**/*.snupkg
|
||||||
|
|
||||||
|
# Test results
|
||||||
|
**/[Tt]est[Rr]esult*/
|
||||||
|
**/[Bb]uild[Ll]og.*
|
||||||
|
|
||||||
|
# Docker files
|
||||||
|
Dockerfile*
|
||||||
|
docker-compose*
|
||||||
|
.dockerignore
|
||||||
|
|
||||||
|
# Git
|
||||||
|
.git/
|
||||||
|
.gitignore
|
||||||
|
.gitattributes
|
||||||
|
|
||||||
|
# IDE
|
||||||
|
.idea/
|
||||||
|
*.swp
|
||||||
|
*.swo
|
||||||
|
*~
|
||||||
|
|
||||||
|
# OS
|
||||||
|
.DS_Store
|
||||||
|
Thumbs.db
|
||||||
|
|
||||||
|
# Data and logs (will be mounted as volumes)
|
||||||
|
data/
|
||||||
|
logs/
|
||||||
|
|
||||||
60
Dockerfile
Normal file
60
Dockerfile
Normal file
|
|
@ -0,0 +1,60 @@
|
||||||
|
# Stage 1: Build
|
||||||
|
# Note: Project files specify net10.0, but using .NET 9.0 based on package versions (9.0.9)
|
||||||
|
# Adjust version if needed: 8.0 (LTS), 9.0 (current), or future 10.0
|
||||||
|
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
|
||||||
|
WORKDIR /src
|
||||||
|
|
||||||
|
# Copy solution file
|
||||||
|
COPY RobotApp.sln .
|
||||||
|
|
||||||
|
# Copy project files
|
||||||
|
COPY RobotApp/RobotApp.csproj RobotApp/
|
||||||
|
COPY RobotApp.Client/RobotApp.Client.csproj RobotApp.Client/
|
||||||
|
COPY RobotApp.Common.Shares/RobotApp.Common.Shares.csproj RobotApp.Common.Shares/
|
||||||
|
COPY RobotApp.VDA5050/RobotApp.VDA5050.csproj RobotApp.VDA5050/
|
||||||
|
|
||||||
|
# Restore dependencies
|
||||||
|
RUN dotnet restore RobotApp.sln
|
||||||
|
|
||||||
|
# Copy all source files
|
||||||
|
COPY RobotApp/ RobotApp/
|
||||||
|
COPY RobotApp.Client/ RobotApp.Client/
|
||||||
|
COPY RobotApp.Common.Shares/ RobotApp.Common.Shares/
|
||||||
|
COPY RobotApp.VDA5050/ RobotApp.VDA5050/
|
||||||
|
|
||||||
|
RUN rm -rf ./RobotApp/RobotApp/bin
|
||||||
|
RUN rm -rf ./RobotApp/RobotApp/obj
|
||||||
|
RUN rm -rf ./RobotApp.Client/RobotApp.Client/bin
|
||||||
|
RUN rm -rf ./RobotApp.Client/RobotApp.Client/obj
|
||||||
|
RUN rm -rf ./RobotApp.Common.Shares/RobotApp.Common.Shares/bin
|
||||||
|
RUN rm -rf ./RobotApp.Common.Shares/RobotApp.Common.Shares/obj
|
||||||
|
RUN rm -rf ./RobotApp.VDA5050/RobotApp.VDA5050/bin
|
||||||
|
RUN rm -rf ./RobotApp.VDA5050/RobotApp.VDA5050/obj
|
||||||
|
|
||||||
|
# Build the solution
|
||||||
|
WORKDIR /src/RobotApp
|
||||||
|
RUN dotnet build -c Release -o /app/build
|
||||||
|
|
||||||
|
# Stage 2: Publish
|
||||||
|
FROM build AS publish
|
||||||
|
WORKDIR /src/RobotApp
|
||||||
|
RUN dotnet publish -c Release -o /app/publish /p:UseAppHost=false
|
||||||
|
|
||||||
|
# Copy published files
|
||||||
|
FROM base AS final
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=publish /app/publish ./
|
||||||
|
|
||||||
|
# Create directory for database
|
||||||
|
RUN mkdir -p /app/data
|
||||||
|
|
||||||
|
# Set environment variables
|
||||||
|
#ENV ASPNETCORE_URLS=http://+:8080
|
||||||
|
ENV ASPNETCORE_ENVIRONMENT=Production
|
||||||
|
|
||||||
|
# Run the application
|
||||||
|
ENTRYPOINT ["dotnet", "RobotApp.dll"]
|
||||||
|
|
||||||
|
|
@ -5,7 +5,6 @@
|
||||||
@using MudBlazor
|
@using MudBlazor
|
||||||
|
|
||||||
@implements IDisposable
|
@implements IDisposable
|
||||||
@attribute [Authorize]
|
|
||||||
|
|
||||||
@inject RobotStateClient RobotStateClient
|
@inject RobotStateClient RobotStateClient
|
||||||
@rendermode InteractiveWebAssemblyNoPrerender
|
@rendermode InteractiveWebAssemblyNoPrerender
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
@page "/logs"
|
@page "/logs"
|
||||||
@rendermode InteractiveWebAssemblyNoPrerender
|
@rendermode InteractiveWebAssemblyNoPrerender
|
||||||
@attribute [Authorize]
|
|
||||||
|
|
||||||
@using Microsoft.AspNetCore.Components.WebAssembly.Authentication
|
@using Microsoft.AspNetCore.Components.WebAssembly.Authentication
|
||||||
@using RobotApp.Client.Models
|
@using RobotApp.Client.Models
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
@rendermode InteractiveWebAssemblyNoPrerender
|
@rendermode InteractiveWebAssemblyNoPrerender
|
||||||
|
|
||||||
@attribute [Authorize]
|
|
||||||
|
|
||||||
<PageTitle>Map Manager</PageTitle>
|
<PageTitle>Map Manager</PageTitle>
|
||||||
|
|
||||||
<div class="d-flex w-100 h-100 p-2 overflow-hidden flex-row">
|
<div class="d-flex w-100 h-100 p-2 overflow-hidden flex-row">
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
@page "/robot-order"
|
@page "/robot-order"
|
||||||
|
|
||||||
@attribute [Authorize]
|
|
||||||
@rendermode InteractiveWebAssemblyNoPrerender
|
@rendermode InteractiveWebAssemblyNoPrerender
|
||||||
|
|
||||||
@using System.Text.Json
|
@using System.Text.Json
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
@page "/robot-config"
|
@page "/robot-config"
|
||||||
@rendermode InteractiveWebAssemblyNoPrerender
|
@rendermode InteractiveWebAssemblyNoPrerender
|
||||||
@attribute [Authorize]
|
|
||||||
|
|
||||||
@inject HttpClient Http
|
@inject HttpClient Http
|
||||||
@inject ISnackbar Snackbar
|
@inject ISnackbar Snackbar
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
@page "/robot-monitor"
|
@page "/robot-monitor"
|
||||||
@rendermode InteractiveWebAssemblyNoPrerender
|
@rendermode InteractiveWebAssemblyNoPrerender
|
||||||
@attribute [Authorize]
|
|
||||||
@inject RobotApp.Client.Services.RobotMonitorService MonitorService
|
@inject RobotApp.Client.Services.RobotMonitorService MonitorService
|
||||||
@implements IAsyncDisposable
|
@implements IAsyncDisposable
|
||||||
|
|
||||||
|
|
@ -40,3 +39,5 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,3 +59,4 @@ window.robotMonitor = {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,6 @@
|
||||||
|
|
||||||
@rendermode InteractiveServer
|
@rendermode InteractiveServer
|
||||||
|
|
||||||
@attribute [Authorize]
|
|
||||||
|
|
||||||
@inject NavigationManager Nav
|
@inject NavigationManager Nav
|
||||||
|
|
||||||
@code
|
@code
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,8 @@ namespace RobotApp.Controllers;
|
||||||
|
|
||||||
[Route("api/[controller]")]
|
[Route("api/[controller]")]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Authorize]
|
//[Authorize]
|
||||||
|
[AllowAnonymous]
|
||||||
public class FileController(Services.Logger<FileController> Logger) : ControllerBase
|
public class FileController(Services.Logger<FileController> Logger) : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly string certificatesPath = "MqttCertificates";
|
private readonly string certificatesPath = "MqttCertificates";
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ namespace RobotApp.Controllers;
|
||||||
|
|
||||||
[Route("api/[controller]")]
|
[Route("api/[controller]")]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
|
//[Authorize]
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
public class ImagesController(Services.Logger<ImagesController> Logger) : ControllerBase
|
public class ImagesController(Services.Logger<ImagesController> Logger) : ControllerBase
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,8 @@ namespace RobotApp.Controllers;
|
||||||
|
|
||||||
[Route("api/[controller]")]
|
[Route("api/[controller]")]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Authorize]
|
//[Authorize]
|
||||||
|
[AllowAnonymous]
|
||||||
public class LogsManagerController(Services.Logger<LogsManagerController> Logger) : ControllerBase
|
public class LogsManagerController(Services.Logger<LogsManagerController> Logger) : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly string LoggerDirectory = "logs";
|
private readonly string LoggerDirectory = "logs";
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using RobotApp.Services.Robot;
|
using RobotApp.Services.Robot;
|
||||||
using RobotApp.VDA5050.Order;
|
using RobotApp.VDA5050.Order;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
|
@ -7,6 +8,8 @@ namespace RobotApp.Controllers;
|
||||||
|
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("api/order")]
|
[Route("api/order")]
|
||||||
|
//[Authorize]
|
||||||
|
[AllowAnonymous]
|
||||||
public class OrderController : ControllerBase
|
public class OrderController : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly RobotOrderController robotOrderController;
|
private readonly RobotOrderController robotOrderController;
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,8 @@ namespace RobotApp.Controllers;
|
||||||
|
|
||||||
[Route("api/[controller]")]
|
[Route("api/[controller]")]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Authorize]
|
//[Authorize]
|
||||||
|
[AllowAnonymous]
|
||||||
public class RobotConfigsController(Services.Logger<RobotConfigsController> Logger, ApplicationDbContext AppDb, RobotConfiguration RobotConfiguration) : ControllerBase
|
public class RobotConfigsController(Services.Logger<RobotConfigsController> Logger, ApplicationDbContext AppDb, RobotConfiguration RobotConfiguration) : ControllerBase
|
||||||
{
|
{
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
|
|
|
||||||
|
|
@ -155,7 +155,7 @@ public static class ApplicationDbExtensions
|
||||||
VDA5050EnableTls = false,
|
VDA5050EnableTls = false,
|
||||||
VDA5050UserName = "robotics",
|
VDA5050UserName = "robotics",
|
||||||
VDA5050Password = "robotics",
|
VDA5050Password = "robotics",
|
||||||
VDA5050TopicPrefix = "uagv/v2"
|
VDA5050TopicPrefix = "uagv/v2",
|
||||||
IsActive = true,
|
IsActive = true,
|
||||||
CreatedAt = DateTime.Now,
|
CreatedAt = DateTime.Now,
|
||||||
UpdatedAt = DateTime.Now,
|
UpdatedAt = DateTime.Now,
|
||||||
|
|
|
||||||
|
|
@ -11,3 +11,4 @@ public class RobotMonitorHub : Hub
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,17 +11,17 @@
|
||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"https": {
|
|
||||||
"commandName": "Project",
|
|
||||||
"dotnetRunMessages": true,
|
|
||||||
"launchBrowser": true,
|
|
||||||
"workingDirectory": "$(TargetDir)",
|
|
||||||
//"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
|
|
||||||
"applicationUrl": "https://0.0.0.0:7150;http://localhost:5229",
|
|
||||||
"environmentVariables": {
|
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
//"https": {
|
||||||
|
// "commandName": "Project",
|
||||||
|
// "dotnetRunMessages": true,
|
||||||
|
// "launchBrowser": true,
|
||||||
|
// "workingDirectory": "$(TargetDir)",
|
||||||
|
// //"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
|
||||||
|
// "applicationUrl": "https://0.0.0.0:7150;http://localhost:5229",
|
||||||
|
// "environmentVariables": {
|
||||||
|
// "ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
// }
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
35
docker-compose.yaml
Normal file
35
docker-compose.yaml
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
version: '3.8'
|
||||||
|
|
||||||
|
services:
|
||||||
|
robotapp:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
container_name: robotapp
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "8080:8080"
|
||||||
|
environment:
|
||||||
|
- ASPNETCORE_ENVIRONMENT=Production
|
||||||
|
- ASPNETCORE_URLS=http://+:8080
|
||||||
|
- ConnectionStrings__DefaultConnection=Data Source=/app/data/robot.db
|
||||||
|
volumes:
|
||||||
|
# Persist database
|
||||||
|
- ./data:/app/data
|
||||||
|
# Persist maps
|
||||||
|
- ./maps:/app/maps
|
||||||
|
# Persist logs (if needed)
|
||||||
|
- ./logs:/app/logs
|
||||||
|
networks:
|
||||||
|
- robotapp-network
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:8080 || exit 1"]
|
||||||
|
interval: 30s
|
||||||
|
timeout: 10s
|
||||||
|
retries: 3
|
||||||
|
start_period: 40s
|
||||||
|
|
||||||
|
networks:
|
||||||
|
robotapp-network:
|
||||||
|
driver: bridge
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user