Created
January 5, 2018 18:46
-
-
Save sebug/1c365276f3844154e08c4c440d25ac0c to your computer and use it in GitHub Desktop.
Pass connection string via docker -e to Entity Framework Core
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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