Compare commits

..
2 Commits
Author SHA1 Message Date
jakub d162031cb6 Any new changes
continuous-integration/drone/push Build is failing
2025-05-21 13:33:22 +02:00
jakub ec13b6de0b Initial Blazor Server Drone demo
continuous-integration/drone/push Build is failing
2025-05-21 13:23:37 +02:00
8 changed files with 81 additions and 14 deletions
+8 -10
View File
@@ -3,19 +3,16 @@ type: docker
name: default name: default
steps: steps:
- name: build
image: mcr.microsoft.com/dotnet/sdk:8.0
commands:
- dotnet publish -c Release -o out
- name: docker-build - name: docker-build
image: plugins/docker image: plugins/docker
settings: settings:
repo: registry.example.com/myblazorapp repo: git.internet-master.cz:5050/jakub/dotnettest
tags: latest tags: latest
dockerfile: Dockerfile dockerfile: Dockerfile
username: your_registry_username username:
password: your_registry_password from_secret: GITEA_REGISTRY_USER
password:
from_secret: GITEA_REGISTRY_PASS
- name: deploy - name: deploy
image: appleboy/drone-ssh image: appleboy/drone-ssh
@@ -25,7 +22,8 @@ steps:
key: key:
from_secret: ssh_private_key from_secret: ssh_private_key
script: script:
- docker pull registry.example.com/myblazorapp:latest - docker login git.internet-master.cz:5050 -u jakub -p $GITEA_REGISTRY_PASS
- docker pull git.internet-master.cz:5050/jakub/dotnettest:latest
- docker stop myblazorapp || true - docker stop myblazorapp || true
- docker rm myblazorapp || true - docker rm myblazorapp || true
- docker run -d --name myblazorapp -p 8080:80 registry.example.com/myblazorapp:latest - docker run -d --name myblazorapp -p 8080:80 git.internet-master.cz:5050/jakub/dotnettest:latest
+3 -2
View File
@@ -1,10 +1,11 @@
# Dockerfile tčest
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src WORKDIR /src
COPY . . COPY MyBlazorApp/ ./MyBlazorApp/
WORKDIR /src/MyBlazorApp
RUN dotnet publish -c Release -o /app/publish RUN dotnet publish -c Release -o /app/publish
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
WORKDIR /app WORKDIR /app
COPY --from=build /app/publish . COPY --from=build /app/publish .
ENTRYPOINT ["dotnet", "MyBlazorApp.dll"] ENTRYPOINT ["dotnet", "MyBlazorApp.dll"]
+9
View File
@@ -0,0 +1,9 @@
<Router AppAssembly="@typeof(Program).Assembly">
<Found Context="routeData">
<RouteView RouteData="@routeData" />
</Found>
<NotFound>
<h1>Page not found</h1>
</NotFound>
</Router>
+6
View File
@@ -0,0 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
</Project>
+3
View File
@@ -0,0 +1,3 @@
@page "/"
<h1>Hello, Blazor world!</h1>
+23
View File
@@ -0,0 +1,23 @@
@page "/"
@namespace MyBlazorApp.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@{
Layout = null;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Hello Blazor</title>
<base href="~/" />
</head>
<body>
<app>
<component type="typeof(App)" render-mode="ServerPrerendered" />
</app>
<script src="_framework/blazor.server.js"></script>
</body>
</html>
+18
View File
@@ -0,0 +1,18 @@
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddRazorPages();
builder.Services.AddServerSideBlazor();
var app = builder.Build();
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error");
}
app.UseStaticFiles();
app.UseRouting();
app.MapBlazorHub();
app.MapFallbackToPage("/_Host");
app.Run();
+9
View File
@@ -0,0 +1,9 @@
@using System.Net.Http
@using Microsoft.AspNetCore.Components
@using Microsoft.AspNetCore.Components.Forms
@using Microsoft.AspNetCore.Components.Routing
@using Microsoft.AspNetCore.Components.Web
@using Microsoft.AspNetCore.Components.Web.Virtualization
@using Microsoft.JSInterop
@using MyBlazorApp