This commit is contained in:
2026-02-25 20:26:57 +01:00
Unverified
parent 24f9ed00e3
commit 019a23a189
12 changed files with 2 additions and 321 deletions

View File

@@ -1,25 +0,0 @@
**/.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

View File

@@ -1,11 +0,0 @@
next-version: 0.5.0
assembly-versioning-scheme: MajorMinorPatch
assembly-file-versioning-scheme: MajorMinorPatch
branches:
master:
regex: ^master$
mode: ContinuousDelivery
increment: Patch
tag: ''
is-release-branch: true

View File

@@ -1,26 +0,0 @@
name: "Pull request to 'dev' branch"
on:
pull_request:
branches:
- "dev/**"
paths:
- 'WatchIt**'
jobs:
build:
name: Dotnet solution build test and unit tests execution
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Test
run: dotnet test --no-build --verbosity normal

View File

@@ -1,26 +0,0 @@
name: "Push to 'dev' branch"
on:
push:
branches:
- "dev/**"
paths:
- 'WatchIt**'
jobs:
build:
name: Dotnet solution build test and unit tests execution
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Test
run: dotnet test --no-build --verbosity normal

View File

@@ -1,45 +0,0 @@
name: "Pull request to 'master' branch"
on:
pull_request:
branches:
- "master"
jobs:
build-dotnet:
name: Dotnet solution build test and unit tests execution
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build solution
run: dotnet build --no-restore
- name: Test
run: dotnet test --no-build --verbosity normal
build-docker:
name: Docker image build test
needs: build-dotnet
runs-on: ubuntu-latest
strategy:
matrix:
app:
- WatchIt.WebAPI
- WatchIt.Website
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Convert name to lowercase
id: name
uses: ASzc/change-string-case-action@v1
with:
string: ${{ matrix.app }}
- name: Build image
run: docker build ${{ github.workspace }} -t ghcr.io/${{github.actor}}/${{ steps.name.outputs.lowercase }}:build-test -f ${{ github.workspace }}/${{ matrix.app }}/Dockerfile

View File

@@ -1,123 +0,0 @@
name: "Push to 'master' branch"
on:
push:
branches:
- "master"
jobs:
publish:
name: Publish
runs-on: ubuntu-latest
strategy:
matrix:
app:
- WatchIt.WebAPI
- WatchIt.Website
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup GitVersion
uses: gittools/actions/gitversion/setup@v0.9.7
with:
versionSpec: 5.x
- name: Determine Version
uses: gittools/actions/gitversion/execute@v0.9.7
id: gitversion
with:
useConfigFile: true
configFilePath: .github/config/gitversion.yml
- name: App Settings Variable Substitution for WatchIt.WebAPI
uses: microsoft/variable-substitution@v1
if: ${{ matrix.app == 'WatchIt.WebAPI' }}
with:
files: ${{ github.workspace }}/${{ matrix.app }}/appsettings.json
env:
ConnectionStrings.Database: ${{ secrets.CONNECTION_STRING }}
Authentication.JWT.Key: ${{ secrets.KEY }}
- name: App Settings Variable Substitution for WatchIt.Website
uses: microsoft/variable-substitution@v1
if: ${{ matrix.app == 'WatchIt.Website' }}
with:
files: ${{ github.workspace }}/${{ matrix.app }}/appsettings.json
env:
Clients.BaseAddress: ${{ secrets.API_URL }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}
- name: Convert name to lowercase
id: name
uses: ASzc/change-string-case-action@v1
with:
string: ${{ matrix.app }}
- name: Build image
run: docker build ${{ github.workspace }} -t ghcr.io/${{github.actor}}/${{ steps.name.outputs.lowercase }}:latest -t ghcr.io/${{github.actor}}/${{ steps.name.outputs.lowercase }}:${{steps.gitversion.outputs.SemVer}} -f ${{ github.workspace }}/${{ matrix.app }}/Dockerfile
- name: Publish image
run: docker push ghcr.io/${{github.actor}}/${{ steps.name.outputs.lowercase }} --all-tags
outputs:
version: ${{ steps.gitversion.outputs.SemVer }}
release:
name: Release
runs-on: ubuntu-latest
needs: publish
steps:
- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{needs.publish.outputs.version}}
release_name: ${{needs.publish.outputs.version}}
draft: false
prerelease: false
deploy:
name: Deploy
runs-on: watchit
needs: publish
if: false
steps:
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}
- name: Stop old WatchIt.WebAPI container
continue-on-error: true
run: docker container stop watchit.webapi
- name: Remove old WatchIt.WebAPI container
continue-on-error: true
run: docker container rm watchit.webapi
- name: Remove old WatchIt.WebAPI image
continue-on-error: true
run: docker image rm ghcr.io/mateuszskoczek/watchit.webapi
- name: Stop old WatchIt.Website container
continue-on-error: true
run: docker container stop watchit.website
- name: Remove old WatchIt.Website container
continue-on-error: true
run: docker container rm watchit.website
- name: Remove old WatchIt.Website image
continue-on-error: true
run: docker image rm ghcr.io/mateuszskoczek/watchit.website
- name: Pull new WatchIt.WebAPI image
run: docker pull ghcr.io/mateuszskoczek/watchit.webapi:latest
- name: Pull new WatchIt.Website image
run: docker pull ghcr.io/mateuszskoczek/watchit.website:latest
- name: Run new WatchIt.WebAPI container
run: docker run -p 1080:8080 -v watchit.webapi:/home/app -d --name watchit.webapi ghcr.io/mateuszskoczek/watchit.webapi:latest
- name: Run new WatchIt.Website container
run: docker run -p 80:8080 -v watchit.website:/home/app -d --name watchit.website ghcr.io/mateuszskoczek/watchit.website:latest
- name: Wait for initialization
run: sleep 10
- name: Check WatchIt.WebAPI container health
run: docker ps | grep "watchit.webapi"
- name: Check WatchIt.Website container health
run: docker ps | grep "watchit.website"

View File

@@ -1,25 +0,0 @@
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base
USER $APP_UID
WORKDIR /app
EXPOSE 8080
EXPOSE 8081
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["WatchIt.WebAPI/WatchIt.WebAPI.csproj", "WatchIt.WebAPI/"]
COPY ["WatchIt.Database/WatchIt.Database.csproj", "WatchIt.Database/"]
COPY ["WatchIt.DTO/WatchIt.DTO.csproj", "WatchIt.DTO/"]
RUN dotnet restore "WatchIt.WebAPI/WatchIt.WebAPI.csproj"
COPY . .
WORKDIR "/src/WatchIt.WebAPI"
RUN dotnet build "WatchIt.WebAPI.csproj" -c $BUILD_CONFIGURATION -o /app/build
FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "WatchIt.WebAPI.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "WatchIt.WebAPI.dll"]

View File

@@ -30,12 +30,6 @@
<ProjectReference Include="..\WatchIt.DTO\WatchIt.DTO.csproj" /> <ProjectReference Include="..\WatchIt.DTO\WatchIt.DTO.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Content Include="..\.dockerignore">
<Link>.dockerignore</Link>
</Content>
</ItemGroup>
<ItemGroup> <ItemGroup>
<_ContentIncludedByDefault Remove="WatchIt.WebAPI.Controllers\obj\project.assets.json" /> <_ContentIncludedByDefault Remove="WatchIt.WebAPI.Controllers\obj\project.assets.json" />
<_ContentIncludedByDefault Remove="WatchIt.WebAPI.Controllers\obj\project.packagespec.json" /> <_ContentIncludedByDefault Remove="WatchIt.WebAPI.Controllers\obj\project.packagespec.json" />

View File

@@ -8,7 +8,7 @@
}, },
"AllowedHosts": "*", "AllowedHosts": "*",
"ConnectionStrings": { "ConnectionStrings": {
"Database": "Host=192.168.55.70;Database=watchit_dev;Username=watchit;Password=Xdv2Etchavbuuho;Include Error Detail=True" "Database": "Host=localhost;Database=watchit;Username=admin;Password=6&f!jdoqYBsW8lB;Include Error Detail=True"
}, },
"Authentication": { "Authentication": {
"JWT": { "JWT": {

View File

@@ -1,25 +0,0 @@
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base
USER $APP_UID
WORKDIR /app
EXPOSE 8080
EXPOSE 8081
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["WatchIt.Website/WatchIt.Website.csproj", "WatchIt.Website/"]
COPY ["WatchIt.DTO/WatchIt.DTO.csproj", "WatchIt.DTO/"]
COPY ["WatchIt.Database/WatchIt.Database.csproj", "WatchIt.Database/"]
RUN dotnet restore "WatchIt.Website/WatchIt.Website.csproj"
COPY . .
WORKDIR "/src/WatchIt.Website"
RUN dotnet build "WatchIt.Website.csproj" -c $BUILD_CONFIGURATION -o /app/build
FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "WatchIt.Website.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "WatchIt.Website.dll"]

View File

@@ -86,11 +86,4 @@
<_ContentIncludedByDefault Remove="WatchIt.Website.Services\WatchIt.Website.Services.Tokens\obj\project.packagespec.json" /> <_ContentIncludedByDefault Remove="WatchIt.Website.Services\WatchIt.Website.Services.Tokens\obj\project.packagespec.json" />
<_ContentIncludedByDefault Remove="WatchIt.Website.Services\WatchIt.Website.Services.Tokens\obj\WatchIt.Website.Services.Tokens.csproj.nuget.dgspec.json" /> <_ContentIncludedByDefault Remove="WatchIt.Website.Services\WatchIt.Website.Services.Tokens\obj\WatchIt.Website.Services.Tokens.csproj.nuget.dgspec.json" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Content Include="..\.dockerignore">
<Link>.dockerignore</Link>
</Content>
</ItemGroup>
</Project> </Project>

View File

@@ -7,7 +7,7 @@
}, },
"AllowedHosts": "*", "AllowedHosts": "*",
"Clients": { "Clients": {
"BaseAddress": "https://localhost:7027" "BaseAddress": "http://localhost:5128"
}, },
"Tokens": { "Tokens": {
"StorageKeys": { "StorageKeys": {