-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
87 lines (58 loc) · 2.73 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
###
### Reworked docker image from https://developer.ibm.com/answers/questions/488740/running-mqclient-pymqi-in-docker/
###
FROM richarddally/cpython:3.8.2_18.04
MAINTAINER r.dally@protonmail.com
# Download and extract the MQ installation files
ARG DIR_EXTRACT=/tmp/mq
ENV ARCHIVE_FILENAME=mqadv_dev914_ubuntu_x86-64.tar.gz
# The URL to download the MQ installer from in tar.gz format
ARG MQ_URL=https://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/messaging/mqadv/${ARCHIVE_FILENAME}
RUN echo $MQ_URL
RUN mkdir -p $DIR_EXTRACT && cd $DIR_EXTRACT
RUN wget --quiet $MQ_URL
RUN tar --ungzip --extract --file mqadv_dev914_ubuntu_x86-64.tar.gz --directory $DIR_EXTRACT
RUN rm ${ARCHIVE_FILENAME}
# Recommended: Remove packages only needed by this script
RUN apt-get purge -y ca-certificates curl
# Recommended: Remove any orphaned packages
RUN apt-get autoremove -y --purge
# Recommended: Create the mqm user ID with a fixed UID and group, so that the file permissions work between different images
RUN groupadd --system --gid 999 mqm
RUN useradd --system --uid 999 --gid mqm mqm
RUN usermod -G mqm root
# The MQ packages to install
ARG MQ_PACKAGES="ibmmq-client ibmmq-sdk ibmmq-runtime"
# Find directory containing .deb files
ARG DIR_DEB=${DIR_EXTRACT}/MQServer
# Find location of mqlicense.sh
ARG MQLICENSE=${DIR_EXTRACT}/MQServer/mqlicense.sh
# Accept the MQ license
RUN ${MQLICENSE} -text_only -accept
RUN echo "deb [trusted=yes] file:${DIR_DEB} ./" > /etc/apt/sources.list.d/IBM_MQ.list
# Install MQ using the DEB packages
RUN apt-get update
RUN apt-get install -y $MQ_PACKAGES
# Remove 32-bit libraries from 64-bit container
RUN find /opt/mqm /var/mqm -type f -exec file {} \; | awk -F: '/ELF 32-bit/{print $1}' | xargs --no-run-if-empty rm -f
# Remove tar.gz files unpacked by RPM postinst scripts
RUN find /opt/mqm -name '*.tar.gz' -delete
# Recommended: Set the default MQ installation (makes the MQ commands available on the PATH)
RUN /opt/mqm/bin/setmqinst -p /opt/mqm -i
# Clean up all the downloaded files
RUN rm -f /etc/apt/sources.list.d/IBM_MQ.list
RUN rm -rf ${DIR_EXTRACT}
# Apply any bug fixes not included in base Ubuntu or MQ image.
# Don't upgrade everything based on Docker best practices https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/#run
RUN apt-get upgrade -y sensible-utils
# End of bug fixes
RUN rm -rf /var/lib/apt/lists/*
# Optional: Update the command prompt with the MQ version
RUN echo "mq:$(dspmqver -b -f 2)" > /etc/debian_chroot && rm -rf /var/mqm
ENV LANG=en_US.UTF-8
RUN export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/mqm/lib64/
# Support the latest functional cmdlevel by default
ENV MQ_QMGR_CMDLEVEL=802
# Always put the MQ data directory in a Docker volume
VOLUME /var/mqm
RUN chmod +x /var/mqm