2024-10-11 17:45:40 +00:00
|
|
|
# Version: 1
|
2025-09-25 18:58:21 +00:00
|
|
|
# Description: Dockerfile for building and running Elsa Server with Datadog and OpenTelemetry auto-instrumentation
|
2024-03-24 19:28:19 +00:00
|
|
|
|
2025-12-10 20:44:48 +00:00
|
|
|
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:10.0 AS build
|
2024-03-24 19:28:19 +00:00
|
|
|
WORKDIR /source
|
|
|
|
|
|
2024-09-24 22:49:21 +00:00
|
|
|
# Copy sources.
|
2024-03-24 19:28:19 +00:00
|
|
|
COPY src/. ./src
|
|
|
|
|
COPY ./NuGet.Config ./
|
|
|
|
|
COPY *.props ./
|
|
|
|
|
|
2024-09-24 22:49:21 +00:00
|
|
|
# Restore packages.
|
2025-03-14 22:17:54 +00:00
|
|
|
RUN dotnet restore "./src/apps/Elsa.Server.Web/Elsa.Server.Web.csproj"
|
2024-03-24 19:28:19 +00:00
|
|
|
|
2024-09-24 22:49:21 +00:00
|
|
|
# Build and publish (UseAppHost=false creates platform independent binaries).
|
2024-09-23 22:27:51 +00:00
|
|
|
WORKDIR /source/src/bundles/Elsa.Server.Web
|
2024-03-24 19:28:19 +00:00
|
|
|
RUN dotnet build "Elsa.Server.Web.csproj" -c Release -o /app/build
|
2025-12-10 20:42:07 +00:00
|
|
|
RUN dotnet publish "Elsa.Server.Web.csproj" -c Release -o /app/publish /p:UseAppHost=false --no-restore -f net10.0
|
2024-03-24 19:28:19 +00:00
|
|
|
|
2024-09-24 22:49:21 +00:00
|
|
|
# Move binaries into smaller base image.
|
2025-12-10 20:44:48 +00:00
|
|
|
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base
|
2024-03-24 19:28:19 +00:00
|
|
|
WORKDIR /app
|
|
|
|
|
COPY --from=build /app/publish ./
|
|
|
|
|
|
2025-09-25 18:58:21 +00:00
|
|
|
# Install runtime dependencies, including CA certificates.
|
|
|
|
|
RUN apt-get update \
|
|
|
|
|
&& apt-get install -y --no-install-recommends \
|
|
|
|
|
ca-certificates \
|
|
|
|
|
curl \
|
|
|
|
|
libpython3.11 \
|
|
|
|
|
python3.11 \
|
|
|
|
|
python3.11-dev \
|
|
|
|
|
python3-pip \
|
|
|
|
|
unzip \
|
|
|
|
|
wget \
|
|
|
|
|
&& update-ca-certificates \
|
|
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
|
|
COPY docker/entrypoint.sh /entrypoint.sh
|
|
|
|
|
RUN chmod +x /entrypoint.sh
|
2024-03-24 19:28:19 +00:00
|
|
|
|
|
|
|
|
# Set PYTHONNET_PYDLL environment variable
|
2024-07-22 12:36:33 +00:00
|
|
|
ENV PYTHONNET_PYDLL=/usr/lib/aarch64-linux-gnu/libpython3.11.so
|
2024-03-24 19:28:19 +00:00
|
|
|
|
2024-09-24 22:49:21 +00:00
|
|
|
# Set environment variables for OpenTelemetry Auto-Instrumentation
|
2025-09-25 18:58:21 +00:00
|
|
|
ENV OTEL_DOTNET_AUTO_HOME=/otel \
|
|
|
|
|
OTEL_LOG_LEVEL="debug"
|
2024-09-24 22:49:21 +00:00
|
|
|
|
|
|
|
|
# Download and extract OpenTelemetry Auto-Instrumentation
|
|
|
|
|
ARG OTEL_VERSION=1.7.0
|
2025-09-25 18:58:21 +00:00
|
|
|
RUN mkdir -p /otel \
|
|
|
|
|
&& curl -L -o /otel/otel-dotnet-install.sh "https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/releases/download/v${OTEL_VERSION}/otel-dotnet-auto-install.sh" \
|
|
|
|
|
&& chmod +x /otel/otel-dotnet-install.sh \
|
|
|
|
|
&& /bin/bash /otel/otel-dotnet-install.sh \
|
|
|
|
|
&& chmod +x /otel/instrument.sh
|
2024-03-24 19:28:19 +00:00
|
|
|
|
|
|
|
|
EXPOSE 8080/tcp
|
|
|
|
|
EXPOSE 443/tcp
|
2024-09-24 22:49:21 +00:00
|
|
|
|
2025-09-25 18:58:21 +00:00
|
|
|
ENTRYPOINT ["/entrypoint.sh"]
|
|
|
|
|
CMD ["dotnet", "Elsa.Server.Web.dll"]
|