Skip to content

Instantly share code, notes, and snippets.

@sebug sebug/Dockerfile
Created Jan 5, 2018

Embed
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
WORKDIR /app
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
WORKDIR /app
COPY --from=build-env /app/Sample/out .
ENTRYPOINT setx SAMPLE_ConnectionString $env:SAMPLE_ConnectionString ; dotnet Sample.dll
@sebug

This comment has been minimized.

Copy link
Owner Author

commented Jan 5, 2018

setx SAMPLE_ConnectionString "Data Source=tcp:1.2.3.4\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.