Skip to content

Commit

Permalink
Initial project setup
Browse files Browse the repository at this point in the history
  • Loading branch information
scogliera committed Dec 9, 2023
1 parent 8f68bf4 commit 13703a0
Show file tree
Hide file tree
Showing 22 changed files with 2,678 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/.idea
**/*.*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
31 changes: 31 additions & 0 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Build and push to TdA

on:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Check Out Repo
uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build and push multi-platform images
uses: docker/build-push-action@v3
with:
context: ./
tags: tda-dotnet:latest
outputs: type=docker,dest=/tmp/tda-dotnet.tar

- name: Upload to TdA
uses: Tour-de-App/upload-app@tda-24
with:
team_secret: ${{ secrets.TEAM_SECRET }}
image_name: tda-dotnet
image_path: /tmp/tda-dotnet.tar
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -396,3 +396,8 @@ FodyWeavers.xsd

# JetBrains Rider
*.sln.iml

bin
obj
.idea
wwwroot\css\site.css
14 changes: 14 additions & 0 deletions App.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Router AppAssembly="@typeof(App).Assembly">
<Found Context="routeData">
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)"/>
<FocusOnNavigate RouteData="@routeData" Selector="h1"/>
</Found>
<NotFound>
<PageTitle>Not found</PageTitle>
<LayoutView Layout="@typeof(MainLayout)">
<p role="alert">Sorry, there's nothing at this address.</p>
</LayoutView>
</NotFound>
</Router>

<AntContainer />
35 changes: 35 additions & 0 deletions Controllers/TdaApiController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using Microsoft.AspNetCore.Mvc;

namespace TeacherDigitalAgency.Controllers;

[ApiController]
[Route("/api")]
public class TdaApiController: ControllerBase
{
private readonly ILogger<TdaApiController> _logger;

public TdaApiController(ILogger<TdaApiController> logger)
{
_logger = logger;
}

[HttpGet(Name = "api")]
public Dictionary<string, string> OnGet()
{
_logger.LogDebug("Base api endpoint called");
return new Dictionary<string, string>
{
{ "secret", "The cake is a lie" }
};
}

[HttpPost(Name = "api")]
public Dictionary<string, string> OnPost()
{
_logger.LogDebug("Base api post endpoint called");
return new Dictionary<string, string>
{
{ "secret", "The cake is a lie" }
};
}
}
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["TeacherDigitalAgency.csproj", "./"]
RUN dotnet restore "TeacherDigitalAgency.csproj"
COPY . .
WORKDIR "/src/"
RUN dotnet build "TeacherDigitalAgency.csproj" -c $BUILD_CONFIGURATION -o /app/build

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

FROM base AS final
WORKDIR /
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "TeacherDigitalAgency.dll"]
3 changes: 3 additions & 0 deletions MainLayout.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@inherits LayoutComponentBase

<main> @Body </main>
10 changes: 10 additions & 0 deletions Pages/Index.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@page "/"

<PageTitle>Teacher Digital Agency</PageTitle>

<Content Class="flex h-screen">
<div class="text-center m-auto">
<Header Class="text-4xl font-bold tracking-tight text-gray-900 sm:text-6xl">Hello TdA</Header>
<Paragraph Class="mt-6 text-lg leading-8 text-gray-600">Educating the Future. Teacher Digital Agency - Expanding the Horizons of Learning. Currently Under Construction, Return Soon to Change the Way You Learn!</Paragraph>
</div>
</Content>
36 changes: 36 additions & 0 deletions Pages/_Host.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
@page "/"
@using Microsoft.AspNetCore.Components.Web
@namespace TeacherDigitalAgency.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="utf-8"/>
<base href="~/"/>
<link rel="icon" type="image/png" href="favicon.png"/>
<link href="css/site.css" rel="stylesheet"/>
<!-- TODO: Compatibility w/ tailwind -->
<!--<link href="_content/AntDesign/css/ant-design-blazor.css" rel="stylesheet" />-->
<script src="_content/AntDesign/js/ant-design-blazor.js"></script>
<component type="typeof(HeadOutlet)" render-mode="ServerPrerendered"/>
</head>

<body>
<component type="typeof(App)" render-mode="ServerPrerendered"/>

<div id="blazor-error-ui">
<environment include="Staging,Production">
An error has occurred. This application may no longer respond until reloaded.
</environment>
<environment include="Development">
An unhandled exception has occurred. See browser dev tools for details.
</environment>
<a href="" class="reload">Reload</a>
<a class="dismiss">🗙</a>
</div>

<script src="_framework/blazor.server.js"></script>
</body>
</html>
25 changes: 25 additions & 0 deletions Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
var builder = WebApplication.CreateBuilder(args);

// Add services to the container
builder.Services.AddRazorPages();
builder.Services.AddServerSideBlazor();
builder.Services.AddControllers();
builder.Services.AddAntDesign();

var app = builder.Build();

if (!app.Environment.IsDevelopment())
{
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}

app.UseHttpsRedirection();
app.UseStaticFiles();

app.UseRouting();
app.MapControllers();
app.MapBlazorHub();
app.MapFallbackToPage("/_Host");

app.Run();
35 changes: 35 additions & 0 deletions Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"iisSettings": {
"iisExpress": {
"applicationUrl": "http://localhost:31598",
"sslPort": 44347
}
},
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "http://localhost:5269",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:7202;http://localhost:5269",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
32 changes: 32 additions & 0 deletions Styles/site.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

#blazor-error-ui {
background: lightyellow;
bottom: 0;
box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
display: none;
left: 0;
padding: 0.6rem 1.25rem 0.7rem 1.25rem;
position: fixed;
width: 100%;
z-index: 1000;
}

#blazor-error-ui .dismiss {
cursor: pointer;
position: absolute;
right: 3.5rem;
top: 0.5rem;
}

.blazor-error-boundary {
background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhd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ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
padding: 1rem 1rem 1rem 3.7rem;
color: white;
}

.blazor-error-boundary::after {
content: "An error has occurred."
}
21 changes: 21 additions & 0 deletions TeacherDigitalAgency.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>

<ItemGroup>
<Content Update="Styles\site.css">
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
</ItemGroup>

<ItemGroup>
<PackageReference Include="AntDesign" Version="0.16.3" />
</ItemGroup>

</Project>
16 changes: 16 additions & 0 deletions TeacherDigitalAgency.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TeacherDigitalAgency", "TeacherDigitalAgency.csproj", "{4C53898E-3E11-4942-894F-9FA10ABF756F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4C53898E-3E11-4942-894F-9FA10ABF756F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4C53898E-3E11-4942-894F-9FA10ABF756F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4C53898E-3E11-4942-894F-9FA10ABF756F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4C53898E-3E11-4942-894F-9FA10ABF756F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
5 changes: 5 additions & 0 deletions _Imports.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@using Microsoft.AspNetCore.Components.Routing
@using Microsoft.AspNetCore.Components.Web
@using Microsoft.JSInterop
@using TeacherDigitalAgency
@using AntDesign
9 changes: 9 additions & 0 deletions appsettings.Development.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"DetailedErrors": true,
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}
9 changes: 9 additions & 0 deletions appsettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}
Loading

0 comments on commit 13703a0

Please sign in to comment.