1212# See the License for the specific language governing permissions and
1313# limitations under the License.
1414
15- ARG BASE_IMAGE=ubuntu:20.04
16- FROM $BASE_IMAGE
15+ ARG BASE_IMAGE=registry.access.redhat.com/ubi8/go-toolset:1.21
16+ FROM $BASE_IMAGE AS builder
1717
1818ARG GOPATH_ARG="/go"
19- ARG GOVERSION=1.18
2019ARG GOARCH=amd64
2120ARG MQARCH=X64
2221
23- ENV GOVERSION=${GOVERSION} \
24- GOPATH=$GOPATH_ARG \
25- GOTAR=go${GOVERSION}.linux-${GOARCH}.tar.gz \
22+ ENV GOPATH=$GOPATH_ARG \
2623 ORG="github.com/ibm-messaging"
2724
28-
29- # Install the Go compiler and Git
30- RUN export DEBIAN_FRONTEND=noninteractive \
31- && bash -c 'source /etc/os-release; \
32- echo "deb http://archive.ubuntu.com/ubuntu/ ${UBUNTU_CODENAME} main restricted" > /etc/apt/sources.list; \
33- echo "deb http://archive.ubuntu.com/ubuntu/ ${UBUNTU_CODENAME}-updates main restricted" >> /etc/apt/sources.list; \
34- echo "deb http://archive.ubuntu.com/ubuntu/ ${UBUNTU_CODENAME}-backports main restricted universe" >> /etc/apt/sources.list; \
35- echo "deb http://archive.ubuntu.com/ubuntu/ ${UBUNTU_CODENAME} universe" >> /etc/apt/sources.list; \
36- echo "deb http://archive.ubuntu.com/ubuntu/ ${UBUNTU_CODENAME}-updates universe" >> /etc/apt/sources.list;' \
37- && apt-get update \
38- && apt-get install -y --no-install-recommends \
39- git \
40- wget \
41- ca-certificates \
42- curl \
43- tar \
44- bash \
45- build-essential \
46- && rm -rf /var/lib/apt/lists/*
25+ # Make sure we've got permissions inside the container
26+ USER 0
4727
4828# Create location for the git clone and MQ installation
4929RUN mkdir -p $GOPATH/src $GOPATH/bin $GOPATH/pkg \
5030 && chmod -R 777 $GOPATH \
5131 && mkdir -p $GOPATH/src/$ORG \
5232 && cd /tmp \
53- && wget -nv https://dl.google.com/go/${GOTAR} \
54- && tar -xf ${GOTAR} \
55- && mv go /usr/lib/go-${GOVERSION} \
56- && rm -f ${GOTAR} \
5733 && mkdir -p /opt/mqm \
5834 && chmod a+rx /opt/mqm
5935
60- # Location of the downloadable MQ client package \
61- ENV RDURL="https://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/messaging/mqdev/redist" \
36+ # Location of the downloadable MQ client package
37+ ARG RDURL_ARG="https://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/messaging/mqdev/redist"
38+ ENV RDURL=${RDURL_ARG} \
6239 RDTAR="IBM-MQC-Redist-Linux${MQARCH}.tar.gz" \
6340 VRMF=9.4.1.0
6441
@@ -77,13 +54,12 @@ RUN cd /opt/mqm \
7754
7855# Insert the script that will do the build
7956COPY --chmod=777 buildInDocker.sh $GOPATH
80- # RUN chmod 777 $GOPATH/buildInDocker.sh
8157
8258# Copy the rest of the source tree from this directory into the container
8359# And make sure it's readable by the id that will run the compiles (not just root)
8460ENV REPO="mq-golang"
8561COPY --chmod=0777 . $GOPATH/src/$ORG/$REPO
86- # RUN chmod -R a+rx $GOPATH/src
8762
8863# Set the entrypoint to the script that will do the compilation
89- ENTRYPOINT $GOPATH/buildInDocker.sh
64+ WORKDIR $GOPATH
65+ ENTRYPOINT [ "./buildInDocker.sh" ]
0 commit comments