Refactor project structure and Docker configurations

The changes included in this commit are made to refactor the project structure and Docker configurations. Previously, the application was structured around the AllInOneWeb solution, but it has been split into Server.Web and ServerAndStudio.Web solutions for better separation of concerns. Additionally, the Docker configurations have been updated to reflect the new structure, which should streamline the build and deployment process.
This commit is contained in:
Sipke Schoorstra 2023-12-27 20:30:33 +01:00
parent 6d4a428c80
commit f17966c592
18 changed files with 43 additions and 74 deletions

View file

@ -1,61 +0,0 @@
name: Build and deploy All In One reference application as Docker image
on:
workflow_dispatch:
push:
branches:
- main
jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: all
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
# list of Docker images to use as base name for tags
images: |
elsaworkflows/elsa-v3
flavor: |
latest=true
# generate Docker tags based on the following events/attributes
tags: |
type=sha
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v3
with:
builder: ${{ steps.buildx.outputs.name }}
context: .
file: ./docker/Dockerfile
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}

View file

@ -12,7 +12,6 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "solution", "solution", "{7D21EB5E-D6B4-48A5-A9BC-A26387A65F0B}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "solution", "solution", "{7D21EB5E-D6B4-48A5-A9BC-A26387A65F0B}"
ProjectSection(SolutionItems) = preProject ProjectSection(SolutionItems) = preProject
.gitignore = .gitignore .gitignore = .gitignore
.github\workflows\all-in-one-web.yml = .github\workflows\all-in-one-web.yml
build-and-run-all-in-one-web-docker.sh = build-and-run-all-in-one-web-docker.sh build-and-run-all-in-one-web-docker.sh = build-and-run-all-in-one-web-docker.sh
common.props = common.props common.props = common.props
configureawait.props = configureawait.props configureawait.props = configureawait.props
@ -20,7 +19,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "solution", "solution", "{7D
icon.png = icon.png icon.png = icon.png
NuGet.Config = NuGet.Config NuGet.Config = NuGet.Config
packages.props = packages.props packages.props = packages.props
.github\workflows\packages.yml = .github\workflows\packages.yml
README.md = README.md README.md = README.md
update-migrations.sh = update-migrations.sh update-migrations.sh = update-migrations.sh
frameworks.props = frameworks.props frameworks.props = frameworks.props
@ -64,9 +62,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Elsa.ProtoActor", "src\modu
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Elsa.Dsl", "src\modules\Elsa.Dsl\Elsa.Dsl.csproj", "{78DAB791-8595-4612-8E9E-2248AF5B1862}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Elsa.Dsl", "src\modules\Elsa.Dsl\Elsa.Dsl.csproj", "{78DAB791-8595-4612-8E9E-2248AF5B1862}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Elsa.AllInOne.Web", "src\bundles\Elsa.AllInOne.Web\Elsa.AllInOne.Web.csproj", "{E31F8955-B221-48AA-B301-6EE317D6F5B1}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Elsa.ServerAndStudio.Web", "src\bundles\Elsa.ServerAndStudio.Web\Elsa.ServerAndStudio.Web.csproj", "{E31F8955-B221-48AA-B301-6EE317D6F5B1}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Elsa.WorkflowServer.Web", "src\bundles\Elsa.WorkflowServer.Web\Elsa.WorkflowServer.Web.csproj", "{3C2752A7-EEBC-4ED4-B1BF-0FCF6E071BC2}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Elsa.Server.Web", "src\bundles\Elsa.Server.Web\Elsa.Server.Web.csproj", "{3C2752A7-EEBC-4ED4-B1BF-0FCF6E071BC2}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Elsa.Workflows.Api", "src\modules\Elsa.Workflows.Api\Elsa.Workflows.Api.csproj", "{C9539BD8-D2AE-4A8D-8281-71A05B3FBF31}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Elsa.Workflows.Api", "src\modules\Elsa.Workflows.Api\Elsa.Workflows.Api.csproj", "{C9539BD8-D2AE-4A8D-8281-71A05B3FBF31}"
EndProject EndProject
@ -120,8 +118,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Elsa.Samples.AspNet.Workflo
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docker", "docker", "{986E5482-0482-448C-B9E4-EC67A9474B85}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docker", "docker", "{986E5482-0482-448C-B9E4-EC67A9474B85}"
ProjectSection(SolutionItems) = preProject ProjectSection(SolutionItems) = preProject
docker\Dockerfile = docker\Dockerfile
docker\.dockerignore = docker\.dockerignore docker\.dockerignore = docker\.dockerignore
docker\ElsaServer.Dockerfile = docker\ElsaServer.Dockerfile
docker\ElsaServerAndStudio.Dockerfile = docker\ElsaServerAndStudio.Dockerfile
EndProjectSection EndProjectSection
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Elsa.Samples.AspNet.RunTaskIntegration", "src\samples\aspnet\Elsa.Samples.AspNet.RunTaskIntegration\Elsa.Samples.AspNet.RunTaskIntegration.csproj", "{51050209-EC2F-4DC7-8F46-07E22B7811CD}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Elsa.Samples.AspNet.RunTaskIntegration", "src\samples\aspnet\Elsa.Samples.AspNet.RunTaskIntegration\Elsa.Samples.AspNet.RunTaskIntegration.csproj", "{51050209-EC2F-4DC7-8F46-07E22B7811CD}"
@ -286,6 +285,13 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elsa.MassTransit.AzureServi
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elsa.Samples.AspNet.Heartbeats", "src\samples\aspnet\Elsa.Samples.AspNet.Heartbeats\Elsa.Samples.AspNet.Heartbeats.csproj", "{26888832-DBEA-4B23-8DC2-84478A702CC4}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elsa.Samples.AspNet.Heartbeats", "src\samples\aspnet\Elsa.Samples.AspNet.Heartbeats\Elsa.Samples.AspNet.Heartbeats.csproj", "{26888832-DBEA-4B23-8DC2-84478A702CC4}"
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "pipelines", "pipelines", "{B789B743-0FBE-4BBC-9F45-84C20C8D4814}"
ProjectSection(SolutionItems) = preProject
.github\workflows\elsa-server-and-studio.yml = .github\workflows\elsa-server-and-studio.yml
.github\workflows\elsa-server.yml = .github\workflows\elsa-server.yml
.github\workflows\packages.yml = .github\workflows\packages.yml
EndProjectSection
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU

View file

@ -1,4 +1,4 @@
**/.dockerignore **/.dockerignore
**/.env **/.env
**/.git **/.git
**/.gitignore **/.gitignore

View file

@ -0,0 +1,24 @@
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0-bookworm-slim AS build
WORKDIR /source
# copy sources.
COPY src/. ./src
COPY ./NuGet.Config ./
COPY *.props ./
# restore packages.
RUN dotnet restore "./src/bundles/Elsa.Server.Web/Elsa.Server.Web.csproj"
# build and publish (UseAppHost=false creates platform independent binaries).
WORKDIR /source/src/bundles/Elsa.AllInOne.Web
RUN dotnet build "Elsa.Server.Web.csproj" -c Release -o /app/build
RUN dotnet publish "Elsa.Server.Web.csproj" -c Release -o /app/publish /p:UseAppHost=false --no-restore -f net8.0
# move binaries into smaller base image.
FROM mcr.microsoft.com/dotnet/aspnet:8.0-bookworm-slim AS base
WORKDIR /app
COPY --from=build /app/publish ./
EXPOSE 80/tcp
EXPOSE 443/tcp
ENTRYPOINT ["dotnet", "Elsa.Server.Web.dll"]

View file

@ -8,12 +8,12 @@ COPY *.props ./
# restore packages. # restore packages.
RUN dotnet restore "./src/bundles/ElsaStudioWebAssembly/ElsaStudioWebAssembly.csproj" RUN dotnet restore "./src/bundles/ElsaStudioWebAssembly/ElsaStudioWebAssembly.csproj"
RUN dotnet restore "./src/bundles/Elsa.AllInOne.Web/Elsa.AllInOne.Web.csproj" RUN dotnet restore "./src/bundles/Elsa.ServerAndStudio.Web/Elsa.ServerAndStudio.Web.csproj"
# build and publish (UseAppHost=false creates platform independent binaries). # build and publish (UseAppHost=false creates platform independent binaries).
WORKDIR /source/src/bundles/Elsa.AllInOne.Web WORKDIR /source/src/bundles/Elsa.AllInOne.Web
RUN dotnet build "Elsa.AllInOne.Web.csproj" -c Release -o /app/build RUN dotnet build "Elsa.ServerAndStudio.Web.csproj" -c Release -o /app/build
RUN dotnet publish "Elsa.AllInOne.Web.csproj" -c Release -o /app/publish /p:UseAppHost=false --no-restore -f net8.0 RUN dotnet publish "Elsa.ServerAndStudio.Web.csproj" -c Release -o /app/publish /p:UseAppHost=false --no-restore -f net8.0
# move binaries into smaller base image. # move binaries into smaller base image.
FROM mcr.microsoft.com/dotnet/aspnet:8.0-bookworm-slim AS base FROM mcr.microsoft.com/dotnet/aspnet:8.0-bookworm-slim AS base
@ -22,4 +22,4 @@ COPY --from=build /app/publish ./
EXPOSE 80/tcp EXPOSE 80/tcp
EXPOSE 443/tcp EXPOSE 443/tcp
ENTRYPOINT ["dotnet", "Elsa.AllInOne.Web.dll"] ENTRYPOINT ["dotnet", "Elsa.ServerAndStudio.Web.dll"]

View file

@ -4,7 +4,7 @@ using Elsa.Workflows;
using Elsa.Workflows.Attributes; using Elsa.Workflows.Attributes;
using Elsa.Workflows.Models; using Elsa.Workflows.Models;
namespace Elsa.WorkflowServer.Web; namespace Elsa.Server.Web;
[Activity("Demo", "Data Source", "Generates a collection of random strings.")] [Activity("Demo", "Data Source", "Generates a collection of random strings.")]
public class DataSourceActivity : CodeActivity<ICollection<string>> public class DataSourceActivity : CodeActivity<ICollection<string>>

View file

@ -1,6 +1,6 @@
using Microsoft.AspNetCore.Cors.Infrastructure; using Microsoft.AspNetCore.Cors.Infrastructure;
namespace Elsa.AllInOne.Web.Extensions; namespace Elsa.ServerAndStudio.Web.Extensions;
public static class CorsOptionsExtensions public static class CorsOptionsExtensions
{ {

View file

@ -1,4 +1,4 @@
using Elsa.AllInOne.Web.Extensions; using Elsa.ServerAndStudio.Web.Extensions;
using Elsa.EntityFrameworkCore.Extensions; using Elsa.EntityFrameworkCore.Extensions;
using Elsa.EntityFrameworkCore.Modules.Management; using Elsa.EntityFrameworkCore.Modules.Management;
using Elsa.EntityFrameworkCore.Modules.Runtime; using Elsa.EntityFrameworkCore.Modules.Runtime;