i actually have two questions.
The first question is regarding the general Dockerfile. The Dockerfile script that I cam up with seemed to build (docker build . . . . .) without error But it seemed overly complicated. I had to get the latest version of node, had to register with apt-get to download the dotnet SDK, and I needed to apt-get another package just to be able to register Microsoft as a provider for the packages. Here is what I came up with:
FROM ubuntu AS build-env
WORKDIR /appRUN apt-get update -y
RUN apt-get install wget software-properties-common -y
RUN wget -q https://nodejs.org/dist/v12.11.1/node-v12.11.1-linux-x64.tar.gz
RUN tar -C /usr/local --strip-components 1 -xzf node-v12.11.1-linux-x64.tar.gz
RUN rm node-v12.11.1-linux-x64.tar.gz
RUN wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
RUN dpkg -i packages-microsoft-prod.debRUN add-apt-repository universe
RUN apt-get update -y
RUN apt-get install apt-transport-https -y
RUN apt-get update -y
RUN apt-get install dotnet-sdk-3.0 -yCopy csproj and restore as distinct layers
COPY *.csproj ./
RUN dotnet restoreCopy everything else and build
COPY . ./
RUN dotnet publish -c Release -o outBuild runtime image
FROM ubuntu
WORKDIR /appRUN apt-get update -y
RUN apt-get install wget software-properties-common -y
RUN wget -q https://nodejs.org/dist/v12.11.1/node-v12.11.1-linux-x64.tar.gz
RUN tar -C /usr/local --strip-components 1 -xzf node-v12.11.1-linux-x64.tar.gz
RUN rm node-v12.11.1-linux-x64.tar.gzRUN wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
RUN dpkg -i packages-microsoft-prod.debRUN add-apt-repository universe
RUN apt-get update -y
RUN apt-get install apt-transport-https -y
RUN apt-get update -y
RUN apt-get install dotnet-runtime-3.0 aspnetcore-runtime-3.0 -yCOPY --from=build-env /app/out .
ENTRYPOINT [“dotnet”, “BSoftSolutions.dll”]
Is there an easier way? Is there a faster way? It seems this build takes about 5 minutes to complete on my laptop.
The second question is having to do with networking that has probably been asked a number of times already. If I create a running container like:
docker run -d -p 5001:5001 -name bsoftapp bsoftapp
then go to my browser https://localhost:5001 I only get a page indicating that the address couldn’t be resolved. I have tried other combinations like 5000:5000 or 8080:80 with the same results. I am not sure how to tell what is the correct port run run on. Right now this app is basically generated from the Angular template in Visual Studio for ASP.NET Core projects.
Thank you.