Created
March 22, 2018 05:41
-
-
Save ermish/560592b5bac9de3fa0acb6998c8864df to your computer and use it in GitHub Desktop.
Useful dotnet core docker scripts
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
#Go to root dir | |
docker build -t my-image-name-here -f ./deploy/dockerfile ./ |
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
#Build the docker image | |
sh docker-build.sh | |
#Stop and remove the old container | |
sh docker-stop.sh | |
#Create container | |
docker run -d --name my_container_name_here --restart=always -p 9001:9001 my-image-name-here:latest |
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
#Run these to stop and remove the progress-api docker app service | |
docker stop my_container_name_here | |
docker rm my_container_name_here |
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 AS build-env | |
WORKDIR /app | |
# Copy everything else and build | |
COPY ./src ./ | |
RUN dotnet publish -c Release -o out | |
# Build runtime image | |
FROM microsoft/aspnetcore:2.0 | |
WORKDIR /app/api | |
COPY --from=build-env /app/api/out . | |
ENTRYPOINT ["dotnet", "api.dll"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment