Created
October 17, 2016 19:01
-
-
Save smailq/34bc0c207cfd3c05a633acb1ec423de8 to your computer and use it in GitHub Desktop.
Simple Makefile for maintaining a Docker image
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
# Get git commit SHA | |
GIT_COMMIT = $(shell git rev-parse HEAD) | |
# Build docker image | |
build: | |
docker build -f Dockerfile -t someorg/myproject:$(GIT_COMMIT) . | |
# Run docker image, exposing port 80 of container image to port 80 of the host | |
run: | |
docker run --name myproject -p 80:80 -d someorg/myproject:$(GIT_COMMIT) | |
# Stop running container and remove the name | |
stop: | |
docker stop myproject | |
docker rm myproject | |
# Pull from git remote, fast forward merge only | |
pull: | |
@date | |
@git pull --ff-only | |
@echo "-------------" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment