Skip to content

Instantly share code, notes, and snippets.



Created Jan 5, 2018
What would you like to do?
Pass connection string via docker -e to Entity Framework Core
FROM microsoft/aspnetcore-build:2.0.4-2.1.3-nanoserver-sac2016 AS build-env
COPY *.sln ./
RUN mkdir Sample
COPY Sample/*.csproj ./Sample/
RUN dotnet restore
# Copy everything else and build
COPY . ./
RUN dotnet publish -c Release -o out
# Build runtime image
FROM microsoft/aspnetcore:2.0.4
COPY --from=build-env /app/Sample/out .
ENTRYPOINT setx SAMPLE_ConnectionString $env:SAMPLE_ConnectionString ; dotnet Sample.dll

This comment has been minimized.

Copy link
Owner Author

@sebug sebug commented Jan 5, 2018

setx SAMPLE_ConnectionString "Data Source=tcp:\Sample;Initial Catalog=Sample_Testing;User ID=srvc-sample;Password=..."

docker run -d -p 1492:80 -e SAMPLE_ConnectionString sample:1.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.