Skip to content

Instantly share code, notes, and snippets.

@ermish
Created March 22, 2018 05:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ermish/560592b5bac9de3fa0acb6998c8864df to your computer and use it in GitHub Desktop.
Save ermish/560592b5bac9de3fa0acb6998c8864df to your computer and use it in GitHub Desktop.
Useful dotnet core docker scripts
#Go to root dir
docker build -t my-image-name-here -f ./deploy/dockerfile ./
#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
#Run these to stop and remove the progress-api docker app service
docker stop my_container_name_here
docker rm my_container_name_here
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