-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
80 lines (68 loc) · 2.82 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
# ActiveMQ image running on CentOS Linux and OpenJDK 8.
#
# Build image with: docker build - < Dockerfile -t synapticiel/activemq:5.16.0 --network="host"
# Run image with: docker run --network="host" synapticiel/activemq:5.16.0
# Inspect image with: docker inspect synapticiel/activemq:5.16.0
# Remove <none> images : docker images | grep none | awk '{ print $3; }' | xargs docker rmi --force
FROM centos:latest
MAINTAINER Synapticiel LLC <[email protected]>
LABEL version="5.16.0" description="Creates an ActiveMQ 5.16.0 server on CentOS Latest"
# Software version number.
ENV VERSION_NUMBER=5.16.0
# Archive name prefix, unpacked archive directory prefix and final directory name.
ENV FINAL_DIRECTORY_NAME=apache-activemq
# Software home directory.
ENV HOME_DIRECTORY=/opt/${FINAL_DIRECTORY_NAME}
# Product download URL.
ENV DOWNLOAD_URL=http://archive.apache.org/dist/activemq/${VERSION_NUMBER}/apache-activemq-${VERSION_NUMBER}-bin.tar.gz
# Name of user that product will be run by.
ENV RUN_AS_USER=activemq
# Configuration directory.
ENV CONFIGURATION_DIRECTORY=${HOME_DIRECTORY}/conf
# Data directory. Will also contain the pid file.
ENV DATA_DIRECTORY=${HOME_DIRECTORY}/data
# Create the user and group that will be used to run the software.
RUN groupadd ${RUN_AS_USER} && useradd -g ${RUN_AS_USER} ${RUN_AS_USER}
# make sure system is up-to-date
RUN yum -y update && \
yum clean all
# install java
RUN yum -y install java-1.8.0-openjdk
RUN yum -y install wget
ENV JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk
#Download
RUN echo "Downloading from ${DOWNLOAD_URL} ..."
RUN wget -q "${DOWNLOAD_URL}"
RUN echo "Download done."
RUN tar xvzf ${FINAL_DIRECTORY_NAME}-*.tar.gz
RUN rm -f ${FINAL_DIRECTORY_NAME}-*.tar.gz
RUN mv ${FINAL_DIRECTORY_NAME}-* ${HOME_DIRECTORY}
# Create configuration, data and logs directories as needed.
RUN mkdir -p ${CONFIGURATION_DIRECTORY}
RUN mkdir -p ${DATA_DIRECTORY}
# Set the owner of the configuration, data and logs directories in case they
# are not located in the home directory or any of its sub-directories.
RUN chown -R ${RUN_AS_USER}:${RUN_AS_USER} ${CONFIGURATION_DIRECTORY}
RUN chown -R ${RUN_AS_USER}:${RUN_AS_USER} ${DATA_DIRECTORY}
# Set the owner of all files related to the software to the user which will be used to run it.
RUN chown -R ${RUN_AS_USER}:${RUN_AS_USER} ${HOME_DIRECTORY}
# Run Active-MQ
RUN echo "Work directory from ${HOME_DIRECTORY} ..."
RUN ls -all ${HOME_DIRECTORY}
WORKDIR ${HOME_DIRECTORY}
CMD ["/bin/sh", "-c", "bin/activemq console"]
# Expose ports for different types of interaction with ActiveMQ:
# Web admin application and HawtIO port.
EXPOSE 8161
# TCP communication port.
EXPOSE 61616
# AMQP port.
EXPOSE 5672
# Stomp port.
EXPOSE 61613
# MQTT port.
EXPOSE 1883
# WS port.
EXPOSE 61614
# Expose configuration, data and log directories.
VOLUME ["${CONFIGURATION_DIRECTORY}", "${DATA_DIRECTORY}"]