Update AllInOne dockerfile
This commit is contained in:
parent
50ac0e9371
commit
0146a8aeb0
|
|
@ -1,2 +1,2 @@
|
|||
docker build -t elsa-3:local -f ./docker/Dockerfile .
|
||||
docker run -t -i -e ASPNETCORE_ENVIRONMENT='Development' -p 13000:80 elsa-3:local
|
||||
docker run -t -i -e ASPNETCORE_ENVIRONMENT='Development' -e HTTP_PORTS=8080 -p 13000:8080 elsa-3:local
|
||||
|
|
@ -1,33 +1,21 @@
|
|||
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0-bookworm-slim AS build
|
||||
WORKDIR /source
|
||||
|
||||
# install node
|
||||
ENV NODE_VERSION=19.0.0
|
||||
RUN apt install -y curl
|
||||
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash
|
||||
ENV NVM_DIR=/root/.nvm
|
||||
RUN . "$NVM_DIR/nvm.sh" && nvm install ${NODE_VERSION}
|
||||
RUN . "$NVM_DIR/nvm.sh" && nvm use v${NODE_VERSION}
|
||||
RUN . "$NVM_DIR/nvm.sh" && nvm alias default v${NODE_VERSION}
|
||||
ENV PATH="/root/.nvm/versions/node/v${NODE_VERSION}/bin/:${PATH}"
|
||||
RUN node --version
|
||||
RUN npm --version
|
||||
|
||||
# restore packages
|
||||
# copy sources.
|
||||
COPY src/. ./src
|
||||
COPY ./NuGet.Config ./
|
||||
COPY *.props ./
|
||||
|
||||
# Restore packages.
|
||||
# restore packages.
|
||||
RUN dotnet restore "./src/bundles/ElsaStudioWebAssembly/ElsaStudioWebAssembly.csproj"
|
||||
RUN dotnet restore "./src/bundles/Elsa.AllInOne.Web/Elsa.AllInOne.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
|
||||
RUN dotnet build "Elsa.AllInOne.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
|
||||
|
||||
# move binaries into smaller base image
|
||||
# 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 ./
|
||||
|
|
|
|||
|
|
@ -36,4 +36,8 @@
|
|||
<PackageReference Include="Elsa.Studio.Login.BlazorWasm" Version="3.0.0-preview.148"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="App_Data\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
@ -8,11 +8,11 @@
|
|||
}
|
||||
},
|
||||
"profiles": {
|
||||
"Elsa.Samles.Web4": {
|
||||
"Elsa.AllInOne.Web": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"applicationUrl": "https://localhost:7193;http://localhost:5193",
|
||||
"applicationUrl": "https://localhost:5001;http://localhost:5000",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
},
|
||||
"Identity": {
|
||||
"Tokens": {
|
||||
"SigningKey": "secret-signing-key",
|
||||
"SigningKey": "c7dc81876a782d502084763fa322429fca015941eac90ce8ca7ad95fc8752035",
|
||||
"AccessTokenLifetime": "1:00:00:00",
|
||||
"RefreshTokenLifetime": "1:00:10:00"
|
||||
},
|
||||
|
|
@ -69,14 +69,7 @@
|
|||
"BasePath": "/api/workflows"
|
||||
},
|
||||
"Webhooks": {
|
||||
"Endpoints": [
|
||||
{
|
||||
"EventTypes": [
|
||||
"RunTask"
|
||||
],
|
||||
"Url": "https://localhost:5002/api/webhooks/run-task"
|
||||
}
|
||||
]
|
||||
"Endpoints": []
|
||||
},
|
||||
"CorsPolicy": {
|
||||
"Origins": ["*"],
|
||||
|
|
|
|||
|
|
@ -16,29 +16,33 @@ public class HomeController : Controller
|
|||
_dbContext = dbContext;
|
||||
_elsaClient = elsaClient;
|
||||
}
|
||||
|
||||
|
||||
public async Task<IActionResult> Index(CancellationToken cancellationToken)
|
||||
{
|
||||
var tasks = await _dbContext.Tasks.Where(x => !x.IsCompleted).ToListAsync(cancellationToken: cancellationToken);
|
||||
var model = new IndexViewModel(tasks);
|
||||
return View(model);
|
||||
}
|
||||
|
||||
|
||||
public async Task<IActionResult> CompleteTask(int taskId, CancellationToken cancellationToken)
|
||||
{
|
||||
var task = _dbContext.Tasks.FirstOrDefault(x => x.Id == taskId);
|
||||
|
||||
|
||||
if (task == null)
|
||||
return NotFound();
|
||||
|
||||
await _elsaClient.ReportTaskCompletedAsync(task.ExternalId, cancellationToken: cancellationToken);
|
||||
|
||||
|
||||
var result = new
|
||||
{
|
||||
Magic = Random.Shared.NextDouble()
|
||||
};
|
||||
await _elsaClient.ReportTaskCompletedAsync(task.ExternalId, result, cancellationToken);
|
||||
|
||||
task.IsCompleted = true;
|
||||
task.CompletedAt = DateTimeOffset.Now;
|
||||
|
||||
|
||||
_dbContext.Tasks.Update(task);
|
||||
await _dbContext.SaveChangesAsync(cancellationToken);
|
||||
|
||||
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
}
|
||||
|
|
@ -24,7 +24,7 @@ builder.Services.AddElsa(elsa =>
|
|||
{
|
||||
identity.TokenOptions = options =>
|
||||
{
|
||||
options.SigningKey = "secret-token-signing-key";
|
||||
options.SigningKey = "c7dc81876a782d502084763fa322429fca015941eac90ce8ca7ad95fc8752035";
|
||||
options.AccessTokenLifetime = TimeSpan.FromDays(1);
|
||||
};
|
||||
|
||||
|
|
@ -37,6 +37,8 @@ builder.Services.AddElsa(elsa =>
|
|||
// Use default authentication (JWT + ApiKey).
|
||||
elsa.UseDefaultAuthentication(auth => auth.UseAdminApiKey());
|
||||
|
||||
elsa.UseJavaScript();
|
||||
|
||||
// Enable SignalR for sending events to Elsa Studio for real-time updates.
|
||||
elsa.UseRealTimeWorkflows();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue