Created
February 10, 2020 03:06
-
-
Save rebelweb/ecb567d793ed36f6012a6288ddca8d61 to your computer and use it in GitHub Desktop.
Dot Net Core API Docker Setup
This file contains hidden or 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
$version=git describe --abbrev=0 | |
$repo="" | |
$versionTag = "$($repo):$($version)" | |
$(aws ecr get-login --no-include-email --region us-west-2) | Invoke-Expression | |
docker build -t $versionTag -f API.Dockerfile . | |
docker push $versionTag |
This file contains hidden or 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 mcr.microsoft.com/dotnet/core/sdk:3.1 AS build-env | |
# Set working directory | |
WORKDIR /app | |
# Copy source code | |
COPY . ./ | |
# Restore packages | |
RUN cd src && dotnet restore | |
# build the app | |
RUN cd /app/src/DayHiker.API && dotnet publish -c Release -o /app/out | |
# build Runtime Image | |
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 | |
WORKDIR /app | |
COPY --from=build-env /app/out . | |
RUN sed -i "s|DEFAULT@SECLEVEL=2|DEFAULT@SECLEVEL=1|g" /etc/ssl/openssl.cnf | |
ENTRYPOINT ["dotnet", "DayHiker.API.dll"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment