Einrichten von IronXL in Docker Containern

Chaknith Bin
Chaknith Bin
18. Januar 2022
Aktualisiert 20. Oktober 2024
Teilen Sie:
This article was translated from English: Does it need improvement?
Translated
View the article in English

Möchten SieLesen, Bearbeiten & Erstellen von Excel-Tabellendateien mit C#?

IronXL unterstützt jetzt vollständig Docker, einschließlich Azure Docker Containers für Linux und Windows.

Docker Azurblau Linux Amazon Windows

Warum Docker verwenden?

Docker ermöglicht es Entwicklern, jede Anwendung als leichtgewichtigen, portablen und autarken Container zu verpacken, auszuliefern und auszuführen, der praktisch überall laufen kann.

IronXL und Linux-Fibel

Wenn Docker mit .NET für Sie neu ist, empfehlen wir Ihnen diesen ausgezeichneten Artikel über die Einrichtung von Docker-Debugging und Integration mit Visual Studio-Projekten. https://docs.microsoft.com/en-us/visualstudio/containers/edit-and-refresh?view=vs-2019

Wir empfehlen Ihnen auch die Lektüre unsererIronXL Linux Einrichtungs- und Kompatibilitätshandbuch

Empfohlene Linux-Docker-Distributionen

Wir empfehlen die unten aufgeführten aktuellen 64-Bit-Linux-Betriebssysteme für die "einfache Konfiguration" von IronPDF.

  • Ubuntu 20
  • Ubuntu 18
  • Debian 11
  • Debian 10 [Derzeit ist die Microsoft Azure Standard-Linux-Distro]
  • CentOS 7
  • CentOS 8

    Wir empfehlen die Verwendung von MicrosoftsOffizielle Docker-Bilder . Andere Linux-Distributionen werden zum Teil unterstützt, erfordern aber möglicherweise eine manuelle Konfiguration mit apt-get. Siehe unser "Linux Manuelle Einrichtung" Leitfaden

    Funktionierende Docker-Dateien für Ubuntu und Debian sind in diesem Dokument enthalten:

IronXL Linux Docker Installation Essentials

Verwenden Sie unser NuGet-Paket

Wir empfehlen die Verwendung desIronXL NuGet-Paket funktioniert bei der Entwicklung unter Windows, macOS und Linux.

Install-Package IronXL.Excel

Ubuntu Linux DockerFiles

Docker Ubuntu

Ubuntu 20 mit .NET 5

FROM mcr.microsoft.com/dotnet/runtime:5.0-focal AS base

WORKDIR /app
FROM mcr.microsoft.com/dotnet/sdk:5.0-focal AS build

WORKDIR /src
KOPIEREN["Beispiel/Beispiel.csproj", "Beispiel/"]

RUN dotnet restore "Beispiel/Beispiel.csproj"
KOPIE . .

WORKDIR "/src/Beispiel"

RUN dotnet build "Beispiel.csproj" -c Release -o /app/build
FROM build AS publish

RUN dotnet publish "Beispiel.csproj" -c Release -o /app/publish
FROM base AS final

WORKDIR /app

COPY --from=publish /app/publish .

ENTRYPOINT["dotnet", "Beispiel.dll"]

Ubuntu 20 mit .NET 3.1 LTS

FROM mcr.microsoft.com/dotnet/runtime:3.1-focal AS base

WORKDIR /app
FROM mcr.microsoft.com/dotnet/sdk:3.1-focal AS build

WORKDIR /src
KOPIEREN["Beispiel/Beispiel.csproj", "Beispiel/"]

RUN dotnet restore "Beispiel/Beispiel.csproj"
KOPIE . .

WORKDIR "/src/Beispiel"

RUN dotnet build "Beispiel.csproj" -c Release -o /app/build
FROM build AS publish

RUN dotnet publish "Beispiel.csproj" -c Release -o /app/publish
FROM base AS final

WORKDIR /app

COPY --from=publish /app/publish .

ENTRYPOINT["dotnet", "Beispiel.dll"]

Ubuntu 18 mit .NET 3.1 LTS

FROM mcr.microsoft.com/dotnet/runtime:3.1-bionic AS base

WORKDIR /app
FROM mcr.microsoft.com/dotnet/sdk:3.1-bionic AS build

WORKDIR /src
KOPIEREN["Beispiel/Beispiel.csproj", "Beispiel/"]

RUN dotnet restore "Beispiel/Beispiel.csproj"
KOPIE . .

WORKDIR "/src/Beispiel"

RUN dotnet build "Beispiel.csproj" -c Release -o /app/build
FROM build AS publish

RUN dotnet publish "Beispiel.csproj" -c Release -o /app/publish
FROM base AS final

WORKDIR /app

COPY --from=publish /app/publish .

ENTRYPOINT["dotnet", "Beispiel.dll"]

Debian Linux DockerFiles

Debian 11 mit .NET 5

FROM mcr.microsoft.com/dotnet/aspnet:5.0-bullseye-slim AS base

WORKDIR /app
FROM mcr.microsoft.com/dotnet/sdk:5.0-bullseye-slim AS build

WORKDIR /src
KOPIEREN["Beispiel/Beispiel.csproj", "Beispiel/"]

RUN dotnet restore "Beispiel/Beispiel.csproj"
KOPIE . .

WORKDIR "/src/Beispiel"

RUN dotnet build "Beispiel.csproj" -c Release -o /app/build
FROM build AS publish

RUN dotnet publish "Beispiel.csproj" -c Release -o /app/publish
FROM base AS final

WORKDIR /app

COPY --from=publish /app/publish .

ENTRYPOINT["dotnet", "Beispiel.dll"]

Debian 11 mit .NET 3.1 LTS

FROM mcr.microsoft.com/dotnet/aspnet:3.1-bullseye-slim AS base

WORKDIR /app
FROM mcr.microsoft.com/dotnet/sdk:3.1-bullseye-slim AS build

WORKDIR /src
KOPIEREN["Beispiel/Beispiel.csproj", "Beispiel/"]

RUN dotnet restore "Beispiel/Beispiel.csproj"
KOPIE . .

WORKDIR "/src/Beispiel"

RUN dotnet build "Beispiel.csproj" -c Release -o /app/build
FROM build AS publish

RUN dotnet publish "Beispiel.csproj" -c Release -o /app/publish
FROM base AS final

WORKDIR /app

COPY --from=publish /app/publish .

ENTRYPOINT["dotnet", "Beispiel.dll"]

Debian 10 mit .NET 5

FROM mcr.microsoft.com/dotnet/runtime:5.0 AS base

WORKDIR /app
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build

WORKDIR /src
KOPIEREN["Beispiel/Beispiel.csproj", "Beispiel/"]

RUN dotnet restore "Beispiel/Beispiel.csproj"
KOPIE . .

WORKDIR "/src/Beispiel"

RUN dotnet build "Beispiel.csproj" -c Release -o /app/build
FROM build AS publish

RUN dotnet publish "Beispiel.csproj" -c Release -o /app/publish
FROM base AS final

WORKDIR /app

COPY --from=publish /app/publish .

ENTRYPOINT["dotnet", "Beispiel.dll"]

Debian 10 mit .NET 3.1 LTS

FROM mcr.microsoft.com/dotnet/runtime:3.1 AS base

WORKDIR /app
FROM mcr.microsoft.com/dotnet/sdk:3.1 AS build

WORKDIR /src
KOPIEREN["Beispiel/Beispiel.csproj", "Beispiel/"]

RUN dotnet restore "Beispiel/Beispiel.csproj"
KOPIE . .

WORKDIR "/src/Beispiel"

RUN dotnet build "Beispiel.csproj" -c Release -o /app/build
FROM build AS publish

RUN dotnet publish "Beispiel.csproj" -c Release -o /app/publish
FROM base AS final

WORKDIR /app

COPY --from=publish /app/publish .

ENTRYPOINT["dotnet", "Beispiel.dll"]

CentOS 7 mit .NET 3.1 LTS

FROM centos:7 AS base

WORKDIR /app
RUN yum install sudo -y

RUN sudo rpm -Uvh https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm

RUN sudo yum install dotnet-sdk-3.1 -y

RUN sudo yum install aspnetcore-runtime-3.1 -y

RUN sudo yum install dotnet-runtime-3.1 -y

RUN sudo yum update -y

WORKDIR /src
KOPIEREN["Beispiel/Beispiel.csproj", "Beispiel/"]

RUN dotnet restore "Beispiel/Beispiel.csproj"
KOPIE . .

WORKDIR "/src/Beispiel"

RUN dotnet build "Beispiel.csproj" -c Release -o /app/build
FROM build AS publish

RUN dotnet publish "Beispiel.csproj" -c Release -o /app/publish
FROM base AS final

WORKDIR /app

COPY --from=publish /app/publish .

ENTRYPOINT["dotnet", "Beispiel.dll"]

CentOS 8 mit .NET 3.1 LTS

FROM centos:8 AS base

WORKDIR /app
RUN yum install sudo -y

RUN sudo rpm -Uvh https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm

RUN sudo yum install dotnet-sdk-3.1 -y

RUN sudo yum install aspnetcore-runtime-3.1 -y

RUN sudo yum install dotnet-runtime-3.1 -y

RUN sudo yum update -y

WORKDIR /src
KOPIEREN["Beispiel/Beispiel.csproj", "Beispiel/"]

RUN dotnet restore "Beispiel/Beispiel.csproj"
KOPIE . .

WORKDIR "/src/Beispiel"

RUN dotnet build "Beispiel.csproj" -c Release -o /app/build
FROM build AS publish

RUN dotnet publish "Beispiel.csproj" -c Release -o /app/publish
FROM base AS final

WORKDIR /app

COPY --from=publish /app/publish .

ENTRYPOINT["dotnet", "Beispiel.dll"]
Chaknith Bin
Software-Ingenieur
Chaknith arbeitet an IronXL und IronBarcode. Er hat tiefgehende Expertise in C# und .NET und hilft, die Software zu verbessern und Kunden zu unterstützen. Seine Erkenntnisse aus Benutzerinteraktionen tragen zu besseren Produkten, Dokumentation und einem insgesamt besseren Erlebnis bei.