Skip to content

Commit

Permalink
Upgrade .Net 8 and Angular 17 (#12)
Browse files Browse the repository at this point in the history
* dotnet update

* update fix

* readme update
  • Loading branch information
nitin27may authored Dec 4, 2023
1 parent 25fcc46 commit c61e826
Show file tree
Hide file tree
Showing 18 changed files with 3,656 additions and 15,082 deletions.
2 changes: 1 addition & 1 deletion Api/Application/Application.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AutoMapper" Version="12.0.1" />
Expand Down
28 changes: 28 additions & 0 deletions Api/Debug.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM mcr.microsoft.com/dotnet/runtime:8.0-preview AS base
WORKDIR /app

USER app
FROM mcr.microsoft.com/dotnet/sdk:8.0-preview AS build
ARG configuration=Release
WORKDIR /src
COPY ["WebApi/WebApi.csproj", "WebApi/"]
COPY ["Application/Application.csproj", "Application/"]
COPY ["Domain/Domain.csproj", "Domain/"]
COPY ["Infrastructure.Shared/Infrastructure.Shared.csproj", "Infrastructure.Shared/"]
COPY ["Infrastructure.Identity/Infrastructure.Identity.csproj", "Infrastructure.Identity/"]
COPY ["Infrastructure.Persistence/Infrastructure.Persistence.csproj", "Infrastructure.Persistence/"]
RUN dotnet restore "WebApi/WebApi.csproj"
COPY . .
WORKDIR "/src/WebApi"

RUN dotnet build "WebApi.csproj" -c $configuration -o /app/build


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

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "WebApi.dll"]
4 changes: 2 additions & 2 deletions Api/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#See https://aka.ms/containerfastmode to understand 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
WORKDIR /app
EXPOSE 8000
ENV ASPNETCORE_URLS=http://+:8000
Expand All @@ -9,7 +9,7 @@ RUN groupadd -g 2000 dotnet \
USER dotnet


FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src
COPY ["WebApi/WebApi.csproj", "WebApi/"]
COPY ["Application/Application.csproj", "Application/"]
Expand Down
2 changes: 1 addition & 1 deletion Api/Domain/Domain.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Api/Infrastructure.Identity/Infrastructure.Identity.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Version>1.1.0</Version>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion Api/Infrastructure.Shared/Infrastructure.Shared.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Version>1.1.0</Version>
<LangVersion>latest</LangVersion>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion Api/WebApi/WebApi.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<UserSecretsId>13baa941-0ae9-449c-8360-2fa7150a14fa</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>
Expand Down
25 changes: 25 additions & 0 deletions Api/WebApi/WebApi.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.002.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebApi", "WebApi.csproj", "{4EC4CF00-9D2F-4DA2-ADAF-2637665E502E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4EC4CF00-9D2F-4DA2-ADAF-2637665E502E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4EC4CF00-9D2F-4DA2-ADAF-2637665E502E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4EC4CF00-9D2F-4DA2-ADAF-2637665E502E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4EC4CF00-9D2F-4DA2-ADAF-2637665E502E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {336FA339-B988-46C5-97C0-DA395E5EFB1F}
EndGlobalSection
EndGlobal
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Full Stack (dotnet, angular and postgres) boilerplate with Docker
### About (Dotnet - Angular - PostgresSQL)
This project is intended to provide a starting point for building full-stack web applicatioin. The stack is made of Dotnet(7) WebApi, Angular (16.2.10), PostgresSQL. The focus of this project to show case the possible way to run a real application (Dotnet, Angular and PostgresSQL) using docker for development enviornment and produciton mode.
This project is intended to provide a starting point for building full-stack web applicatioin. The stack is made of Dotnet(7) WebApi, Angular (17.0.3), PostgresSQL. The focus of this project to show case the possible way to run a real application (Dotnet, Angular and PostgresSQL) using docker for development enviornment and produciton mode.

This is a simple web application. It has working user registration, login page and there is a complete example of CRUD which contains example for Angular Routing and dotnet rest api samples. Also, rest services are secure using JWT.

Expand All @@ -27,7 +27,7 @@ The apps written in the following JavaScript frameworks/libraries:
| **WebApi** | [Rest Api using **dotnet**](https://github.com/nitin27may/angular-dotnet-core-docker/tree/master/WebApi) |

### Built With
#### Angular (16.2.10)
#### Angular (17.0.3)

The fronend of this project is developed in Angular. As we are using Server Side Rendering (SSR) we have used Nodejs alpine image in place of other lightweight docker image like nginx to run Angular app.

Expand All @@ -44,7 +44,7 @@ Also, it has sample code for Auth guard, services, http interceptors, resolver a
**[Dockerfile for Production](/frontend/Dockerfile)**
**[Dockerfile for Development](/frontend/debug.dockerfile)**

#### Dotnet (7.0.0)
#### Dotnet (8.0.0)

Rest APis of this project is devloped using dotnet

Expand Down
2 changes: 1 addition & 1 deletion docker-debug-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ services:
- "postgres"
build:
context: Api/
dockerfile: debug.dockerfile
dockerfile: Debug.Dockerfile
restart: always

volumes:
Expand Down
6 changes: 3 additions & 3 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Create image based off of the official Node 10 image
FROM node:20-alpine as builder
FROM node:21-alpine as builder

# Copy dependency definitions
COPY package.json package-lock.json ./

## installing and Storing node modules on a separate layer will prevent unnecessary npm installs at each build
RUN npm ci && mkdir /app && mv ./node_modules ./app
RUN npm i --legacy-peer-deps && mkdir /app && mv ./node_modules ./app

# Change directory so that our commands run inside this new directory
WORKDIR /app
Expand All @@ -16,7 +16,7 @@ COPY . /app/
# Build bundles
RUN npm run build:output

FROM node:20-alpine
FROM node:21-alpine
## From 'builder' copy published folder
COPY --from=builder /app /app

Expand Down
2 changes: 1 addition & 1 deletion frontend/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Frontend (Angular)

Frontend for application using Angular (updated to 16.2.10)
Frontend for application using Angular (updated to 17.0.3)

## Development server

Expand Down
12 changes: 6 additions & 6 deletions frontend/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,21 +85,21 @@
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "frontend:build"
"buildTarget": "frontend:build"
},
"configurations": {
"production": {
"browserTarget": "frontend:build:production"
"buildTarget": "frontend:build:production"
},
"development": {
"browserTarget": "frontend:build:development"
"buildTarget": "frontend:build:development"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "frontend:build"
"buildTarget": "frontend:build"
}
},
"test": {
Expand Down Expand Up @@ -152,7 +152,7 @@
}
},
"serve-ssr": {
"builder": "@nguniversal/builders:ssr-dev-server",
"builder": "@angular-devkit/build-angular:ssr-dev-server",
"options": {
"browserTarget": "frontend:build",
"serverTarget": "frontend:server"
Expand All @@ -165,7 +165,7 @@
}
},
"prerender": {
"builder": "@nguniversal/builders:prerender",
"builder": "@angular-devkit/build-angular:prerender",
"options": {
"browserTarget": "frontend:build:production",
"serverTarget": "frontend:server:production",
Expand Down
5 changes: 2 additions & 3 deletions frontend/debug.dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Create image based off of the official 12.8-alpine
FROM node:20-alpine
FROM node:21-alpine

#RUN echo "nameserver 8.8.8.8" | tee /etc/resolv.conf > /dev/null
WORKDIR /app
Expand All @@ -8,12 +8,11 @@ WORKDIR /app
COPY package*.json ./

## installing and Storing node modules on a separate layer will prevent unnecessary npm installs at each build
RUN npm i --legacy-peer-deps
RUN npm i --legacy-peer-deps --unsafe-perm=true --allow-root

RUN npm install -g @angular/cli

COPY . /app/

EXPOSE 4200 49153


Loading

0 comments on commit c61e826

Please sign in to comment.