build Ubuntu image on non-RHEL hosts

This commit is contained in:
Arthur Barr
2018-10-02 13:33:20 +01:00
committed by Stephen Marshall
parent 31f604cc47
commit d0fce28ef3
2 changed files with 25 additions and 36 deletions

View File

@@ -17,66 +17,54 @@
############################################################################### ###############################################################################
GO_PKG_DIRS = ./cmd ./internal ./test GO_PKG_DIRS = ./cmd ./internal ./test
BASE_OS = $(shell cat /etc/*-release | grep ID=) # Set variable if running on a Red Hat Enterprise Linux host
ifeq "$(findstring ubuntu,$(BASE_OS))" "ubuntu" ifneq ($(wildcard /etc/redhat-release),)
BASE_OS=UBUNTU REDHAT_RELEASE = $(shell cat /etc/redhat-release)
else ifeq "$(findstring rhel,$(BASE_OS))" "rhel" ifeq "$(findstring Red Hat,$(REDHAT_RELEASE))" "Red Hat"
BASE_OS=RHEL RHEL_HOST = "true"
else endif
BASE_OS=UNKNOWN
endif endif
############################################################################### ###############################################################################
# Build targets # Build targets
############################################################################### ###############################################################################
# default to building UBUNTU as this was the default for the previous Makefile # Targets default to a RHEL image on a RHEL host, or an Ubuntu image everywhere else
.PHONY: build-devserver .PHONY: build-devserver
ifeq ($(BASE_OS),UBUNTU) ifdef RHEL_HOST
build-devserver: build-devserver-ubuntu
else ifeq ($(BASE_OS),RHEL)
build-devserver: build-devserver-rhel build-devserver: build-devserver-rhel
else else
build-devserver: unknownos build-devserver: build-devserver-ubuntu
endif endif
.PHONY: build-advancedserver .PHONY: build-advancedserver
ifeq ($(BASE_OS),UBUNTU) ifdef RHEL_HOST
build-advancedserver: build-advancedserver-ubuntu
else ifeq ($(BASE_OS),RHEL)
build-advancedserver: build-advancedserver-rhel build-advancedserver: build-advancedserver-rhel
else else
build-advancedserver: unknownos build-advancedserver: build-advancedserver-ubuntu
endif endif
.PHONY: test-devserver .PHONY: test-devserver
ifeq ($(BASE_OS),UBUNTU) ifdef RHEL_HOST
test-devserver: test-devserver-ubuntu
else ifeq ($(BASE_OS),RHEL)
test-devserver: test-devserver-rhel test-devserver: test-devserver-rhel
else else
test-devserver: unknownos test-devserver: test-devserver-ubuntu
endif endif
.PHONY: test-advancedserver .PHONY: test-advancedserver
ifeq ($(BASE_OS),UBUNTU) ifdef RHEL_HOST
test-advancedserver: test-advancedserver-ubuntu
else ifeq ($(BASE_OS),RHEL)
test-advancedserver: test-advancedserver-rhel test-advancedserver: test-advancedserver-rhel
else else
test-advancedserver: unknownos test-advancedserver: test-advancedserver-ubuntu
endif endif
.PHONY: build-devjmstest .PHONY: build-devjmstest
ifeq ($(BASE_OS),UBUNTU) ifdef RHEL_HOST
build-devjmstest: build-devjmstest-ubuntu
else ifeq ($(BASE_OS),RHEL)
build-devjmstest: build-devjmstest-rhel build-devjmstest: build-devjmstest-rhel
else else
build-devjmstest: unknownos build-devjmstest: build-devjmstest-ubuntu
endif endif
# UBUNTU building targets # UBUNTU building targets

View File

@@ -5,7 +5,6 @@
### Prerequisites for building an Ubuntu image ### Prerequisites for building an Ubuntu image
If you want to build a container image with Ubuntu Linux as the base OS, then you need to have the following tools installed: If you want to build a container image with Ubuntu Linux as the base OS, then you need to have the following tools installed:
You need to ensure you have the following tools installed:
* [Docker](https://www.docker.com/) V17.06.1 or later * [Docker](https://www.docker.com/) V17.06.1 or later
* [GNU make](https://www.gnu.org/software/make/) * [GNU make](https://www.gnu.org/software/make/)
@@ -14,8 +13,8 @@ If you are working in the Windows Subsystem for Linux, follow [this guide by Mic
### Prerequisites for building a Red Hat Enterprise Linux image ### Prerequisites for building a Red Hat Enterprise Linux image
If you want to build a container image with Red Hat Enterprise Linux as the base OS, then you need to use a host server with Red Hat Enterprise Linux. You must also have the following tools installed: If you want to build a container image with Red Hat Enterprise Linux as the base OS, then you need to use a host server with Red Hat Enterprise Linux. You must also have the following tools installed:
* `[buildah](https://buildah.io)` (available in `rhel-7-server-extras`) * [`buildah`](https://buildah.io) (available in `rhel-7-server-extras`)
* `[podman](https://podman.io)` (available in `rhel-7-server-extras`) * [`podman`](https://podman.io) (available in `rhel-7-server-extras`)
In addition, you need the following commonly installed tools: In addition, you need the following commonly installed tools:
@@ -31,11 +30,13 @@ In addition, you need the following commonly installed tools:
This procedure works for building the MQ Continuous Delivery release, on `x86_64`, `ppc64le` and `s390x` architectures. This procedure works for building the MQ Continuous Delivery release, on `x86_64`, `ppc64le` and `s390x` architectures.
1. Create a `downloads` directory in the root of this repository 1. Create a `downloads` directory in the root of this repository
2. Download MQ from IBM Passport Advantage, and place the downloaded file (for example, `IBM_MQ_9.1.0.0_UBUNTU_X86-64.tar.gz` for MQ V9.1.0 for Ubuntu on x86_64 architecture) in the `downloads` directory 2. Download MQ from [IBM Passport Advantage](https://www.ibm.com/software/passportadvantage/) or [IBM Fix Central](https://www.ibm.com/support/fixcentral), and place the downloaded file (for example, `IBM_MQ_9.1_UBUNTU_X86-64.tar.gz` for MQ V9.1.0 for Ubuntu on x86_64 architecture) in the `downloads` directory
2. Run `make build-advancedserver-ubuntu` or `make build-advancedserver-rhel` 3. Run `make build-advancedserver`
> **Warning**: Note that MQ offers two different sets of packaging on Linux: one is called "MQ for Linux" and contains RPM files for installing on Red Hat Enterprise Linux and SUSE Linux Enterprise Server. The other package is called "MQ for Ubuntu", and contains DEB files for installing on Ubuntu. > **Warning**: Note that MQ offers two different sets of packaging on Linux: one is called "MQ for Linux" and contains RPM files for installing on Red Hat Enterprise Linux and SUSE Linux Enterprise Server. The other package is called "MQ for Ubuntu", and contains DEB files for installing on Ubuntu.
On a Red Hat Enterprise Linux host, the command `make build-advancedserver` will build a container image using Red Hat Enterprise Linux as the base. On all other hosts, the base image will be Ubuntu.
You can build a different version of MQ by setting the `MQ_VERSION` environment variable, for example: You can build a different version of MQ by setting the `MQ_VERSION` environment variable, for example:
```bash ```bash
@@ -49,7 +50,7 @@ MQ_ARCHIVE=mq-1.2.3.4.tar.gz MQ_VERSION=1.2.3.4 make build-advancedserver
``` ```
## Building a developer image ## Building a developer image
Run `make build-devserver-ubuntu` or `make build-devserver-rhel`, which will download the latest version of MQ Advanced for Developers from IBM developerWorks. This is currently only available on the `x86_64` architecture. Run `make build-devserver`, which will download the latest version of MQ Advanced for Developers from IBM developerWorks. This is currently only available on the `x86_64` architecture. On a Red Hat Enterprise Linux host, this command will build a container image using Red Hat Enterprise Linux as the base. On all other hosts, the base image will be Ubuntu.
You can use the environment variable `MQ_ARCHIVE_DEV` to specify an alternative local file to install from (which must be in the `downloads` directory). You can use the environment variable `MQ_ARCHIVE_DEV` to specify an alternative local file to install from (which must be in the `downloads` directory).