Docker Community Forums

Share and learn in the Docker community.

How install java in docker

Hello, I have .net app console which uses jar file. In windows to run this app I installed newest java but how I can do it in docker? This is my dockerfile

FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base
WORKDIR /app
RUN apt-get update
RUN apt-get install -y software-properties-common
RUN rm -rf /var/lib/apt/lists/*

FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build
WORKDIR /src
COPY ["WireMockx/WireMockx.csproj", "WireMockx/"]
RUN dotnet restore "WireMockx/WireMockx.csproj"
COPY . .
WORKDIR "/src/WireMockx"
RUN dotnet build "WireMockx.csproj" -c Release -o /app/build

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

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "WireMockx.dll"]