Skip to content

Commit 0aa808a

Browse files
Modified Word to PDF docker samples version to .NET80
1 parent 12e5420 commit 0aa808a

File tree

4 files changed

+58
-11
lines changed
  • Word-to-PDF-Conversion/Convert-Word-document-to-PDF/Docker

4 files changed

+58
-11
lines changed
Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,36 @@
1-
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
1+
# Use the official .NET 8.0 SDK image from Microsoft for building the application
2+
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
3+
RUN apt-get update -y && apt-get install libfontconfig -y
4+
WORKDIR /src
25

6+
# Copy the project file and restore dependencies
7+
COPY ["WordToPDFDockerSample.csproj", "."]
8+
RUN dotnet restore "WordToPDFDockerSample.csproj"
9+
10+
# Copy the rest of the application code and build the application
11+
COPY . .
12+
RUN dotnet build "WordToPDFDockerSample.csproj" -c Release -o /app/build
13+
14+
# Publish the application
15+
FROM build AS publish
16+
RUN dotnet publish "WordToPDFDockerSample.csproj" -c Release -o /app/publish /p:UseAppHost=false
17+
18+
# Use CentOS 8 as the base image for the final runtime
319
FROM centos:8
420

5-
Run dnf install dotnet-sdk-8.0 -y
6-
RUN dnf install dotnet-runtime-8.0 -y
21+
# Install .NET 8.0 runtime
22+
RUN dnf install -y https://packages.microsoft.com/config/centos/8/prod.repo \
23+
&& dnf install -y dotnet-runtime-8.0 \
24+
&& dnf clean all
25+
26+
# Install fontconfig for fonts
27+
RUN dnf install -y fontconfig
28+
29+
# Set the working directory
30+
WORKDIR /app
731

8-
RUN dnf install fontconfig -y
32+
# Copy the published application from the previous stage
33+
COPY --from=publish /app/publish .
934

10-
ENTRYPOINT ["dotnet" "WordToPDFDockerSample.dll"]
35+
# Set the entry point for the container
36+
ENTRYPOINT ["dotnet", "WordToPDFDockerSample.dll"]

Word-to-PDF-Conversion/Convert-Word-document-to-PDF/Docker/Fedora/WordToPDFDockerSample/Dockerfile

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,26 @@
22

33
FROM fedora:latest
44

5+
# Install .NET 8.0 SDK and runtime
56
Run dnf install dotnet-sdk-8.0 -y
67
RUN dnf install dotnet-runtime-8.0 -y
78

9+
# Install fontconfig for font support
810
RUN dnf install fontconfig -y
911

10-
ENTRYPOINT ["dotnet" "WordToPDFDockerSample.dll"]
12+
# Set the working directory
13+
WORKDIR /app
14+
15+
# Copy the application files
16+
COPY ["WordToPDFDockerSample.csproj", "."]
17+
RUN dotnet restore "WordToPDFDockerSample.csproj"
18+
COPY . .
19+
20+
# Build the application
21+
RUN dotnet build "WordToPDFDockerSample.csproj" -c Release -o /app/build
22+
23+
# Publish the application
24+
RUN dotnet publish "WordToPDFDockerSample.csproj" -c Release -o /app/publish
25+
26+
# Set the final stage to use the runtime image
27+
ENTRYPOINT ["dotnet", "WordToPDFDockerSample.dll"]

Word-to-PDF-Conversion/Convert-Word-document-to-PDF/Docker/RHEL/WordToPDFDockerSample/Dockerfile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22

33
FROM registry.access.redhat.com/ubi8/dotnet-80-runtime AS base
44
USER root
5-
RUN yum -y install fontconfig --disablerepo=epel
6-
WORKDIR /
5+
RUN microdnf install -y fontconfig \
6+
&& microdnf clean all
7+
WORKDIR /app
78

9+
# Use Red Hat Universal Base Image (UBI) 8 with .NET 8.0 SDK for building the application
810
FROM registry.access.redhat.com/ubi8/dotnet-80 AS build
911
WORKDIR /src
1012
COPY ["WordToPDFDockerSample.csproj", ""]
@@ -13,10 +15,12 @@ COPY . .
1315
WORKDIR "/src/."
1416
RUN dotnet build "WordToPDFDockerSample.csproj" -c Release -o /app/build
1517

18+
# Publish the application
1619
FROM build AS publish
1720
RUN dotnet publish "WordToPDFDockerSample.csproj" -c Release -o /app/publish
1821

22+
# Use the .NET 8.0 runtime to run the application
1923
FROM base AS final
2024
WORKDIR /app
2125
COPY --from=publish /app/publish .
22-
ENTRYPOINT ["dotnet", "WordToPDFDockerSample.dll"]
26+
ENTRYPOINT ["dotnet", "WordToPDFDockerSample.dll"]

Word-to-PDF-Conversion/Convert-Word-document-to-PDF/Docker/Ubuntu/WordToPDFDockerSample/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
22

3-
FROM mcr.microsoft.com/dotnet/runtime:8.0-bionic AS base
3+
FROM mcr.microsoft.com/dotnet/runtime:8.0-jammy AS base
44
RUN apt-get update -y && apt-get install fontconfig -y
55
WORKDIR /app
66

7-
FROM mcr.microsoft.com/dotnet/sdk:8.0-bionic AS build
7+
FROM mcr.microsoft.com/dotnet/sdk:8.0-jammy AS build
88
WORKDIR /src
99
COPY ["WordToPDFDockerSample.csproj", "."]
1010
RUN dotnet restore "./WordToPDFDockerSample.csproj"

0 commit comments

Comments
 (0)