Skip to content

Commit

Permalink
Merge branch 'main' of github.com:NetCoreTemplates/nextjs
Browse files Browse the repository at this point in the history
  • Loading branch information
mythz committed Nov 24, 2023
2 parents 8740517 + 5aeb90f commit b77eadd
Show file tree
Hide file tree
Showing 10 changed files with 54 additions and 86 deletions.
35 changes: 35 additions & 0 deletions .deploy/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
version: "3.9"
services:
app:
image: ghcr.io/${IMAGE_REPO}:${RELEASE_VERSION}
restart: always
ports:
- "8080"
container_name: ${APP_NAME}_app
environment:
VIRTUAL_HOST: ${HOST_DOMAIN}
VIRTUAL_PORT: 8080 # New default ASP.NET port -> https://learn.microsoft.com/en-us/dotnet/core/compatibility/containers/8.0/aspnet-port
LETSENCRYPT_HOST: ${HOST_DOMAIN}
LETSENCRYPT_EMAIL: ${LETSENCRYPT_EMAIL}
DEPLOY_API: ${DEPLOY_API}
DEPLOY_CDN: ${DEPLOY_CDN}
volumes:
- app-mydb:/app/App_Data

app-migration:
image: ghcr.io/${IMAGE_REPO}:${RELEASE_VERSION}
restart: "no"
container_name: ${APP_NAME}_app_migration
profiles:
- migration
command: --AppTasks=migrate
volumes:
- app-mydb:/app/App_Data

networks:
default:
external: true
name: nginx

volumes:
app-mydb:
12 changes: 6 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,15 +143,15 @@ jobs:
echo "IMAGE_REPO=${{ env.image_repository_name }}" >> .env
echo "RELEASE_VERSION=${{ env.TAG_NAME }}" >> .env
# Copy only the docker-compose.yml to remote server home folder
- name: copy files to target server via scp
uses: appleboy/[email protected]
with:
host: ${{ secrets.DEPLOY_API }}
username: ${{ secrets.DEPLOY_USERNAME }}
port: 22
key: ${{ secrets.DEPLOY_KEY }}
source: "./docker-compose.yml,./docker-compose.prod.yml,./.env"
strip_components: 2
source: "./.deploy/docker-compose.yml,./.deploy/.env"
target: "~/.deploy/${{ github.event.repository.name }}/"

- name: Run remote db migrations
Expand All @@ -168,8 +168,8 @@ jobs:
script: |
echo $APPTOKEN | docker login ghcr.io -u $USERNAME --password-stdin
cd ~/.deploy/${{ github.event.repository.name }}
docker compose -f ./docker-compose.yml -f ./docker-compose.prod.yml pull
docker compose -f ./docker-compose.yml -f ./docker-compose.prod.yml up app-migration
docker compose pull
docker compose up app-migration
# Deploy Docker image with your application using `docker compose up` remotely
- name: remote docker-compose up via ssh
Expand All @@ -186,5 +186,5 @@ jobs:
script: |
echo $APPTOKEN | docker login ghcr.io -u $USERNAME --password-stdin
cd ~/.deploy/${{ github.event.repository.name }}
docker compose -f ./docker-compose.yml -f ./docker-compose.prod.yml pull
docker compose -f ./docker-compose.yml -f ./docker-compose.prod.yml up app -d
docker compose pull
docker compose up app -d
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/sdk:6.0-focal AS build
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /app

COPY ./api .
Expand All @@ -7,7 +7,7 @@ RUN dotnet restore
WORKDIR /app/MyApp
RUN dotnet publish -c release -o /out --no-restore

FROM mcr.microsoft.com/dotnet/aspnet:6.0-focal AS runtime
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
WORKDIR /app
COPY --from=build /out .
ENTRYPOINT ["dotnet", "MyApp.dll"]
4 changes: 2 additions & 2 deletions api/MyApp.ServiceInterface/MyApp.ServiceInterface.csproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">

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

<ItemGroup>
<PackageReference Include="ServiceStack" Version="6.*" />
<PackageReference Include="ServiceStack" Version="8.*" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions api/MyApp.ServiceModel/MyApp.ServiceModel.csproj
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="ServiceStack.Interfaces" Version="6.*" />
<PackageReference Include="ServiceStack.Interfaces" Version="8.*" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions api/MyApp.Tests/MyApp.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<DebugType>portable</DebugType>
<OutputType>Library</OutputType>
</PropertyGroup>
Expand All @@ -13,8 +13,8 @@
<PackageReference Include="NUnit" Version="3.13.*" />
<PackageReference Include="NUnit3TestAdapter" Version="4.1.*" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.*" />
<PackageReference Include="ServiceStack" Version="6.*" />
<PackageReference Include="ServiceStack.Kestrel" Version="6.*" />
<PackageReference Include="ServiceStack" Version="8.*" />
<PackageReference Include="ServiceStack.Kestrel" Version="8.*" />
</ItemGroup>

</Project>
8 changes: 4 additions & 4 deletions api/MyApp/MyApp.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
Expand All @@ -24,9 +24,9 @@
</Target>

<ItemGroup>
<PackageReference Include="ServiceStack" Version="6.*" />
<PackageReference Include="ServiceStack.OrmLite.Sqlite" Version="6.*" />
<PackageReference Include="ServiceStack.Server" Version="6.*" />
<PackageReference Include="ServiceStack" Version="8.*" />
<PackageReference Include="ServiceStack.OrmLite.Sqlite" Version="8.*" />
<PackageReference Include="ServiceStack.Server" Version="8.*" />
</ItemGroup>

<ItemGroup>
Expand Down
19 changes: 0 additions & 19 deletions docker-compose.override.yml

This file was deleted.

33 changes: 0 additions & 33 deletions docker-compose.prod.yml

This file was deleted.

15 changes: 0 additions & 15 deletions docker-compose.yml

This file was deleted.

0 comments on commit b77eadd

Please sign in to comment.