Skip to content

Commit

Permalink
Add target to create a release build of Docker image
Browse files Browse the repository at this point in the history
Release builds for Docker Hub are special snow flakes. A release build
has to be tagged with a version number. We also want to start with the
latest base image and refresh all layers to get security fixes.

Signed-off-by: Christian Heimes <cheimes@redhat.com>
  • Loading branch information
tiran committed Mar 1, 2017
1 parent 732fbb6 commit b92d66c
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ SERVER_SOCKET = $(CURDIR)/server_socket

DOCKER_CMD = docker
DOCKER_IMAGE = latchset/custodia
DOCKER_RELEASE_ARGS = --no-cache=true --pull=true

CONTAINER_NAME = custodia_container
CONTAINER_VOL = $(CURDIR)/vol
CONTAINER_SOCKET = $(CONTAINER_VOL)/run/sock
Expand Down Expand Up @@ -93,11 +95,13 @@ release: clean egg_info README
run: egg_info
$(PYTHON) -m custodia.server $(CONF)

.PHONY = dockerbuild dockerdemo dockerdemoinit dockershell
.PHONY: dockerbuild dockerdemo dockerdemoinit dockershell dockerreleasebuild
dockerbuild:
rm -f dist/custodia*.whl
$(PYTHON) setup.py bdist_wheel
$(DOCKER_CMD) build -f contrib/docker/Dockerfile -t $(DOCKER_IMAGE) .
$(DOCKER_CMD) build $(DOCKER_BUILD_ARGS) \
-f contrib/docker/Dockerfile \
-t $(DOCKER_IMAGE) .

dockerdemo: dockerbuild
@mkdir -p -m755 $(CONTAINER_VOL)/lib $(CONTAINER_VOL)/log $(CONTAINER_VOL)/run
Expand All @@ -124,6 +128,10 @@ dockerdemoinit:
dockershell:
$(DOCKER_CMD) exec -ti $(CONTAINER_NAME) /bin/bash

.PHONY=dockerpush
dockerpush: dockerbuild
docker push $(DOCKER_IMAGE)
dockerrelasebuild:
VERSION=$$($(PYTHON) -c \
"import pkg_resources; print(pkg_resources.get_distribution('custodia').version)") && \
$(MAKE) dockerbuild \
DOCKER_BUILD_ARGS="$(DOCKER_RELEASE_ARGS)" \
DOCKER_IMAGE="$(DOCKER_IMAGE):$${VERSION}" && \
echo -e "\n\nRun: $(DOCKER_CMD) push $(DOCKER_IMAGE):$${VERSION}"

0 comments on commit b92d66c

Please sign in to comment.