Skip to content

Commit fb2794d

Browse files
committed
Change Dockerfile base build image
1 parent f2988d7 commit fb2794d

File tree

2 files changed

+30
-9
lines changed

2 files changed

+30
-9
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# Changelog
22
Newest updates are at the top of this file.
33

4+
### Mar 21 2024 (v5.5.4.1)
5+
* Update main Dockerfile to use different base build image
6+
because of glibc issues when copying into regular MQ container
7+
48
### Feb 29 2024 (v5.5.4)
59
* Update to MQ 9.3.5
610
* Update all vendored dependencies

Dockerfile

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# syntax=docker/dockerfile:1
22

3-
# This Dockerfile shows how you can both build and run a container with
3+
# This Dockerfile shows how you can both build and run a container with
44
# a specific exporter/collector program. It uses two stages, copying the relevant
55
# material from the build step into the runtime container.
66
#
@@ -15,7 +15,13 @@ ARG EXPORTER=mq_prometheus
1515
# --- --- --- --- --- --- --- --- --- --- --- --- --- --- #
1616
## ### ### ### ### ### ### BUILD ### ### ### ### ### ### ##
1717
# --- --- --- --- --- --- --- --- --- --- --- --- --- --- #
18-
FROM golang:1.20 AS builder
18+
# We start with a slightly older ubuntu rather than, say, a prebuilt
19+
# golang image because the newer go images have a glibc that is newer
20+
# than that in the current MQ container image. And that causes the collector
21+
# to fail if layered into the MQ container.
22+
#
23+
# At least there is a golang 1.20 available for this level of ubuntu.
24+
FROM ubuntu:20.04 AS builder
1925

2026
ARG EXPORTER
2127
ENV EXPORTER=${EXPORTER} \
@@ -28,12 +34,23 @@ ENV EXPORTER=${EXPORTER} \
2834
genmqpkg_incsdk=1 \
2935
genmqpkg_inctls=1
3036

37+
ENV GOVERSION=1.20
38+
3139
# Install packages
3240
RUN apt-get update \
3341
&& apt-get install -y --no-install-recommends \
3442
ca-certificates \
43+
curl \
44+
tar \
45+
golang-$GOVERSION \
3546
build-essential
3647

48+
# The compiler is in a non-default location
49+
ENV GO=/usr/lib/go-${GOVERSION}/bin/go
50+
RUN $GO version
51+
52+
USER 0
53+
3754
# Create directory structure
3855
RUN mkdir -p /go/src /go/bin /go/pkg \
3956
&& chmod -R 777 /go \
@@ -45,17 +62,17 @@ RUN mkdir -p /go/src /go/bin /go/pkg \
4562
# Install MQ client and SDK
4663
# For platforms with a Redistributable client, we can use curl to pull it in and unpack it.
4764
# For most other platforms, we assume that you have deb files available under the current directory
48-
# and we then copy them into the container image. Use dpkg to install from them; these have to be
49-
# done in the right order.
65+
# and we then copy them into the container image. Use dpkg to install from them; these have to be
66+
# done in the right order.
5067
#
51-
# The Linux ARM64 image is a full-function server package that is directly unpacked.
68+
# The Linux ARM64 image is a full-function server package that is directly unpacked.
5269
# We only need a subset of the files so strip the unneeded filesets. The download of the image could
5370
# be automated via curl in the same way as the Linux/amd64 download, but it's a much bigger image and
5471
# has a different license. So I'm not going to do that for now.
55-
#
72+
#
5673
# If additional Redistributable Client platforms appear, then this block can be altered, including the MQARCH setting.
57-
#
58-
# The copy of the README is so that at least one file always gets copied, even if you don't have the deb files locally.
74+
#
75+
# The copy of the README is so that at least one file always gets copied, even if you don't have the deb files locally.
5976
# Using a wildcard in the directory name also helps to ensure that this part of the build always succeeds.
6077
COPY README.md MQINST*/*deb MQINST*/*tar.gz /MQINST
6178

@@ -108,7 +125,7 @@ RUN buildStamp=`date +%Y%m%d-%H%M%S`; \
108125
bp="$os/$hw"; \
109126
if [ -r master ]; then gitCommit=`cat master`;else gitCommit="Unknown";fi; \
110127
BUILD_EXTRA_INJECT="-X \"main.BuildStamp=$buildStamp\" -X \"main.BuildPlatform=$bp\" -X \"main.GitCommit=$gitCommit\""; \
111-
go build -mod=vendor -ldflags "$BUILD_EXTRA_INJECT" -o /go/bin/${EXPORTER} ./*.go
128+
$GO build -mod=vendor -ldflags "$BUILD_EXTRA_INJECT" -o /go/bin/${EXPORTER} ./*.go
112129

113130
# --- --- --- --- --- --- --- --- --- --- --- --- --- --- #
114131
### ### ### ### ### ### ### RUN ### ### ### ### ### ### ###

0 commit comments

Comments
 (0)