Visual Studio 2017 15.3 Dockerize Database Project

Viewed 1102

Have Visual Studio 2017 (15.3) solution with two projects:

  • An API written in ASP.NET Core 2 MVC
  • Database Project

I was able to "dockerize" the MVC project easily (right click, add Docker support) but while trying to dockerize the Database project keep getting the error: Value cannot be null. Parameter name: stream. My Google-fu is failing me; the closest resource found is for Visual Studio 15.2.

How I've Setup Database Project So Far

Added Dockerfile to root:

FROM microsoft/mssql-server-linux:latest
EXPOSE 1433
ENV ACCEPT_EULA=Y
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
ENV MSSQL_TCP_PORT=1433

# Add Database project output from VS build process
RUN mkdir --parents /_scripts/generated
COPY ./_scripts /_scripts/
COPY ./_scripts/generated/*.sql /_scripts/generated/
# Add shell script that starts MSSQL server, waits 60 seconds, then executes script to build out DB (script generated from VS build process)
CMD /bin/bash /_scripts/entrypoint.sh

Modified docker-compose.yml file to include new project

version: '3'

services:
  webapp-api-service:
    image: webapp-api
    build:
      context: ./src/API
      dockerfile: Dockerfile

  webapp-db-service:
    image: webapp-db
    build:
      context: ./src/Database
      dockerfile: Dockerfile

Modified docker-composeoverride.yml file to expose port for dev SSMS access

version: '3'

services:
  webapp-api-service:
    environment:
      - ASPNETCORE_ENVIRONMENT=Development
    ports:
      - "80"

  webapp-db-service:
    ports:
      - "1433"

Here's the build output

2>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(279,5): error : Value cannot be null.
2>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(279,5): error : Parameter name: stream
2>Done building project "docker-compose.dcproj" -- FAILED.

Thanks in advance!

2 Answers
Related