Docker changes to speed up github build
This commit is contained in:
parent
d9094575fd
commit
91bf6b43bc
|
|
@ -1,16 +1,4 @@
|
|||
FROM node:15-alpine as client-build
|
||||
|
||||
WORKDIR /app
|
||||
COPY /src .
|
||||
|
||||
WORKDIR /app/designer/elsa-workflows-studio
|
||||
RUN npm install --force
|
||||
RUN npm run build
|
||||
|
||||
WORKDIR /app/designer/bindings/blazor/Elsa.Designer.Bindings.Blazor
|
||||
RUN npm install --force
|
||||
RUN npm run build
|
||||
|
||||
# This dockerfile requires that all NPM packages there installed and build.
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/sdk:5.0-buster-slim-amd64 AS build
|
||||
WORKDIR /source
|
||||
|
|
@ -23,8 +11,6 @@ RUN dotnet restore "./src/samples/dashboard/aspnetcore/ElsaDashboard.Samples.Asp
|
|||
COPY src/. ./src
|
||||
COPY *.props ./
|
||||
COPY ./Nuget.Config ./
|
||||
COPY --from=client-build /app/designer/elsa-workflows-studio ./src/designer/elsa-workflows-studio
|
||||
COPY --from=client-build /app/designer/bindings/blazor/Elsa.Designer.Bindings.Blazor ./src/designer/bindings/blazor/Elsa.Designer.Bindings.Blazor
|
||||
|
||||
|
||||
# build and publish (UseAppHost=false created platform independent binaries)
|
||||
|
|
|
|||
43
docker/Dockerfile-with-npm
Normal file
43
docker/Dockerfile-with-npm
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
FROM node:15-alpine as client-build
|
||||
|
||||
WORKDIR /app
|
||||
COPY /src .
|
||||
|
||||
WORKDIR /app/designer/elsa-workflows-studio
|
||||
RUN npm install --force
|
||||
RUN npm run build
|
||||
|
||||
WORKDIR /app/designer/bindings/blazor/Elsa.Designer.Bindings.Blazor
|
||||
RUN npm install --force
|
||||
RUN npm run build
|
||||
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/sdk:5.0-buster-slim-amd64 AS build
|
||||
WORKDIR /source
|
||||
|
||||
# restore packages
|
||||
COPY ./src/samples/dashboard/aspnetcore/ElsaDashboard.Samples.AspNetCore.Monolith/ElsaDashboard.Samples.AspNetCore.Monolith.csproj ./src/samples/dashboard/aspnetcore/ElsaDashboard.Samples.AspNetCore.Monolith/ElsaDashboard.Samples.AspNetCore.Monolith.csproj
|
||||
RUN dotnet restore "./src/samples/dashboard/aspnetcore/ElsaDashboard.Samples.AspNetCore.Monolith/ElsaDashboard.Samples.AspNetCore.Monolith.csproj"
|
||||
|
||||
# copy required source code
|
||||
COPY src/. ./src
|
||||
COPY *.props ./
|
||||
COPY ./Nuget.Config ./
|
||||
COPY --from=client-build /app/designer/elsa-workflows-studio ./src/designer/elsa-workflows-studio
|
||||
COPY --from=client-build /app/designer/bindings/blazor/Elsa.Designer.Bindings.Blazor ./src/designer/bindings/blazor/Elsa.Designer.Bindings.Blazor
|
||||
|
||||
|
||||
# build and publish (UseAppHost=false created platform independent binaries)
|
||||
WORKDIR /source/src/samples/dashboard/aspnetcore/ElsaDashboard.Samples.AspNetCore.Monolith
|
||||
RUN dotnet build "ElsaDashboard.Samples.AspNetCore.Monolith.csproj" -c Release -o /app/build
|
||||
RUN dotnet publish "ElsaDashboard.Samples.AspNetCore.Monolith.csproj" -c Release -o /app/publish /p:UseAppHost=false --no-restore
|
||||
|
||||
|
||||
# move binaries into smaller base image
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:5.0-buster-slim AS base
|
||||
WORKDIR /app
|
||||
COPY --from=build /app/publish ./
|
||||
|
||||
EXPOSE 80/tcp
|
||||
EXPOSE 443/tcp
|
||||
ENTRYPOINT ["dotnet", "ElsaDashboard.Samples.AspNetCore.Monolith.dll"]
|
||||
|
|
@ -3,8 +3,8 @@
|
|||
Clone the repository and open a command line in the project root folder. Then you can run the two docker commands below to build and start the container. Alternatively you can use the provided docker-compose file in the docker folder that does it for you via `docker-compuse up -d`. The docker-compose file will also include a fake smtp server to test email delivery.
|
||||
|
||||
```
|
||||
$ docker build -t elsadashboard:local -f ./docker/Dockerfile .
|
||||
$ docker run -t -i -e ELSA__HTTP__BASEURL='http://localhost' -e DASHBOARD__ELSASERVERURL='http://localhost:6868' -e ASPNETCORE_ENVIRONMENT='Development' -p 6868:80 elsadashboard:latest
|
||||
$ docker build -t elsadashboard:local -f ./docker/Dockerfile-with-npm .
|
||||
$ docker run -t -i -e Elsa__Server__BaseAddress='http://localhost:6868' -e ASPNETCORE_ENVIRONMENT='Development' -p 6868:80 elsadashboard:latest
|
||||
```
|
||||
|
||||
The dashboard will be available on port `6868` and if you used the docker-compose file to start the application you will find a fake SMTP server on port `2525`.
|
||||
|
|
@ -5,16 +5,15 @@ services:
|
|||
elsa-dashboard:
|
||||
build:
|
||||
context: ../
|
||||
dockerfile: ./docker/Dockerfile
|
||||
dockerfile: ./docker/Dockerfile-with-npm
|
||||
image: elsadashboard:latest
|
||||
# Use the below image if you do not like to build the image yourself
|
||||
# image: ghcr.io/elsa-workflows/elsa-core/elsa-dashboard:latest
|
||||
container_name: elsa-dashboard
|
||||
environment:
|
||||
- ASPNETCORE_ENVIRONMENT=Development
|
||||
- Elsa:Http:BaseUrl=http://localhost
|
||||
- Elsa:Server:BaseAddress=http://localhost:6868
|
||||
- Elsa:Smtp:Host=smtp4dev
|
||||
- Dashboard:ElsaServerUrl=http://localhost:6868
|
||||
ports:
|
||||
- "6868:80"
|
||||
depends_on:
|
||||
|
|
|
|||
Loading…
Reference in a new issue