aspnet / aspnet-docker

[Archived] ASP.NET Core Docker images for 1.x. Go to https://github.com/dotnet/dotnet-docker for 2.1 and up.
https://asp.net
719 stars 171 forks source link

Unsure how to install certificate on aspnetcore nanoserver image #413

Closed Robrownn closed 6 years ago

Robrownn commented 6 years ago

I'm not sure if this is the right place for this but I need to be able to install a certificate on the aspnetcore:2.0 nanoserver-1709 image but I'm unsure of how to do this. At first I thought I could use powershell to install the certificate but the 1709 image doesn't come with powershell installed. I saw in another issue that the solution to using powershell in the nanoserver image is to do a multi-stage build with the windowsservercore image but again I'm not really sure how I would go about doing this.

Here's my Dockerfile and docker-compose.yml:

Dockerfile

FROM microsoft/aspnetcore:2.0-nanoserver-1709 AS base
WORKDIR /app
EXPOSE 80

FROM microsoft/aspnetcore-build:2.0-nanoserver-1709 AS build
WORKDIR /src
COPY MyApp.sln ./
COPY MyApp/MyApp.csproj MyApp/
RUN dotnet restore -nowarn:msb3202,nu1503
COPY . .
WORKDIR /src/MyApp
RUN dotnet restore
RUN dotnet ef database update
RUN dotnet build -c Release -o /app

FROM build AS publish
RUN dotnet publish -c Release -o /app

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

docker-compose.yml

version: '3'

services:
  myapp:
    image: myapp
    ports:
    - "5000:80"
    build:
      context: .
      dockerfile: MyApp\Dockerfile
    container_name: "myapp"
    hostname: "myapp"
    depends_on:
      - db
  db:
    image: "microsoft/mssql-server-windows-express"
    environment:
      SA_PASSWORD: ""
      ACCEPT_EULA: "Y"
    container_name: "myappdb"
    hostname: "myappdb"

Thanks!

natemcmaster commented 6 years ago

I'm not sure either. You might have better luck getting a good answer on StackOverflow where the audience is much larger.

Robrownn commented 6 years ago

Alright, thanks for your help anyway!

On Tue, Apr 24, 2018 at 5:05 PM, Nate McMaster notifications@github.com wrote:

I'm not sure either. You might have better luck getting a good answer on StackOverflow where the audience is much larger.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/aspnet/aspnet-docker/issues/413#issuecomment-384079775, or mute the thread https://github.com/notifications/unsubscribe-auth/AIos5MvPQhpkGz_TTUGcD2OiLAsU2BrRks5tr5OjgaJpZM4TiGoO .