Skip to content

Commit

Permalink
packaging/docker-image: Move Docker files to their own directory
Browse files Browse the repository at this point in the history
Like other packaging files, they should not be part of RabbitMQ itself.
One day, they will probably be moved to a dedicated repository, like
other packaging files.
  • Loading branch information
dumbbell committed Nov 16, 2020
1 parent bec7d25 commit 4568ab0
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 22 deletions.
24 changes: 4 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,8 @@ clean-unpacked-source-dist:
.PHONY: packages package-deb \
package-rpm package-rpm-fedora package-rpm-suse \
package-windows \
package-generic-unix
package-generic-unix \
docker-image

# This variable is exported so sub-make instances know where to find the
# archive.
Expand All @@ -350,28 +351,11 @@ packages package-deb package-rpm \
package-rpm-redhat package-rpm-fedora package-rpm-rhel6 package-rpm-rhel7 \
package-rpm-rhel8 package-rpm-suse package-rpm-opensuse package-rpm-sles11 \
package-windows \
package-generic-unix: $(PACKAGES_SOURCE_DIST_FILE)
package-generic-unix \
docker-image: $(PACKAGES_SOURCE_DIST_FILE)
$(verbose) $(MAKE) -C packaging $@ \
SOURCE_DIST_FILE=$(abspath $(PACKAGES_SOURCE_DIST_FILE))

$(PACKAGES_DIR)/rabbitmq-server-generic-unix-$(PROJECT_VERSION).tar.xz:
$(verbose) $(MAKE) package-generic-unix

# Docker is different because we need to build & publish
OTP_VERSION := 22.3
OTP_SHA256 := 886e6dbe1e4823c7e8d9c9c1ba8315075a1a9f7717f5a1eaf3b98345ca6c798e
docker-image: $(PACKAGES_DIR)/rabbitmq-server-generic-unix-$(PROJECT_VERSION).tar.xz
$(verbose) (cd PACKAGES && tar xJvf rabbitmq-server-generic-unix-$(PROJECT_VERSION).tar.xz) \
&& docker build --pull \
--build-arg PGP_KEYSERVER=pgpkeys.uk \
--build-arg OTP_VERSION=$(OTP_VERSION) \
--build-arg OTP_SHA256=$(OTP_SHA256) \
--build-arg RABBITMQ_VERSION=$(PROJECT_VERSION) \
--build-arg RABBITMQ_BUILD=PACKAGES/rabbitmq_server-$(PROJECT_VERSION) \
--tag pivotalrabbitmq/rabbitmq:$(PROJECT_VERSION) \
. \
&& docker push pivotalrabbitmq/rabbitmq:$(PROJECT_VERSION)

# --------------------------------------------------------------------
# Installation.
# --------------------------------------------------------------------
Expand Down
8 changes: 6 additions & 2 deletions packaging/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ all: packages
package-rpm-rhel6 package-rpm-rhel7 package-rpm-rhel8 \
package-rpm-suse package-rpm-opensuse package-rpm-sles11 \
package-windows \
package-generic-unix
package-generic-unix \
docker-image

PACKAGES_DIR ?= ../PACKAGES
SOURCE_DIST_FILE ?= $(wildcard $(PACKAGES_DIR)/rabbitmq-server-*.tar.xz)
Expand Down Expand Up @@ -108,9 +109,12 @@ package-windows: $(SOURCE_DIST_FILE)
package-generic-unix: $(SOURCE_DIST_FILE)
$(gen_verbose) $(MAKE) -C generic-unix $(VARS) all $(DO_CLEAN)

docker-image: package-generic-unix
$(gen_verbose) $(MAKE) -C docker-image $(VARS) all $(DO_CLEAN)

.PHONY: clean

clean:
for subdir in debs/Debian RPMS/Fedora windows windows-exe generic-unix; do \
for subdir in debs/Debian RPMS/Fedora windows windows-exe generic-unix docker-image; do \
$(MAKE) -C "$$subdir" clean; \
done
File renamed without changes.
35 changes: 35 additions & 0 deletions packaging/docker-image/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
GENERIC_UNIX_ARCHIVE ?= $(wildcard $(PACKAGES_DIR)/rabbitmq-server-generic-unix-*.tar.xz)

ifneq ($(filter-out clean,$(MAKECMDGOALS)),)
ifeq ($(GENERIC_UNIX_ARCHIVE),)
$(error Cannot find generic-unix archive; please specify GENERIC_UNIX_ARCHIVE)
endif
ifneq ($(words $(SOURCE_DIST_FILE)),1)
$(error Multiple generic-unix archives found; please specify GENERIC_UNIX_ARCHIVE)
endif

VERSION ?= $(patsubst rabbitmq-server-generic-unix-%.tar.xz,%,$(notdir $(GENERIC_UNIX_ARCHIVE)))
ifeq ($(VERSION),)
$(error Cannot determine version; please specify VERSION)
endif
endif

OTP_VERSION ?= 22.3
OTP_SHA256 ?= 886e6dbe1e4823c7e8d9c9c1ba8315075a1a9f7717f5a1eaf3b98345ca6c798e

all: dist

dist:
xzcat $(GENERIC_UNIX_ARCHIVE) | tar xvf -
echo docker build --pull \
--build-arg PGP_KEYSERVER=pgpkeys.uk \
--build-arg OTP_VERSION=$(OTP_VERSION) \
--build-arg OTP_SHA256=$(OTP_SHA256) \
--build-arg RABBITMQ_VERSION=$(VERSION) \
--build-arg RABBITMQ_BUILD=rabbitmq_server-$(VERSION) \
--tag pivotalrabbitmq/rabbitmq:$(VERSION) \
. \
&& docker push pivotalrabbitmq/rabbitmq:$(VERSION)

clean:
rm -rf rabbitmq_server-*
File renamed without changes.

0 comments on commit 4568ab0

Please sign in to comment.