ARTEMIS-2245 Cleaning up Docker images preparation, run and docs

This commit is contained in:
Francesco Nigro 2019-02-08 12:30:52 +01:00 committed by Clebert Suconic
parent 75cebe90b4
commit c77e64a574
5 changed files with 22 additions and 25 deletions

View File

@ -31,10 +31,8 @@ ENV CREATE_ARGUMENTS --user ${ARTEMIS_USER} --password ${ARTEMIS_PASSWORD} --sil
USER root USER root
# add user and group for artemis # add user and group for artemis
RUN groupadd -g 1001 -r artemis && useradd -r -u 1001 -g artemis artemis RUN groupadd -g 1001 -r artemis && useradd -r -u 1001 -g artemis artemis \
&& yum install -y libaio && yum -y clean all
RUN yum install -y libaio && \
yum -y clean all
USER artemis USER artemis
@ -68,4 +66,4 @@ VOLUME ["/var/lib/artemis-instance"]
WORKDIR /var/lib/artemis-instance WORKDIR /var/lib/artemis-instance
ENTRYPOINT ["/docker-run.sh"] ENTRYPOINT ["/docker-run.sh"]
CMD ["artemis-server"] CMD ["run"]

View File

@ -29,10 +29,9 @@ ENV ANONYMOUS_LOGIN false
ENV CREATE_ARGUMENTS --user ${ARTEMIS_USER} --password ${ARTEMIS_PASSWORD} --silent --http-host 0.0.0.0 --relax-jolokia ENV CREATE_ARGUMENTS --user ${ARTEMIS_USER} --password ${ARTEMIS_PASSWORD} --silent --http-host 0.0.0.0 --relax-jolokia
# add user and group for artemis # add user and group for artemis
RUN groupadd -g 1000 -r artemis && useradd -r -u 1000 -g artemis artemis RUN groupadd -g 1000 -r artemis && useradd -r -u 1000 -g artemis artemis \
&& apt-get -qq -o=Dpkg::Use-Pty=0 update && \
RUN apt-get -qq -o=Dpkg::Use-Pty=0 update && \ apt-get -qq -o=Dpkg::Use-Pty=0 install -y --no-install-recommends \
apt-get -qq -o=Dpkg::Use-Pty=0 install -y --no-install-recommends \
libaio1=0.3.110-3 && \ libaio1=0.3.110-3 && \
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*
@ -68,4 +67,4 @@ VOLUME ["/var/lib/artemis-instance"]
WORKDIR /var/lib/artemis-instance WORKDIR /var/lib/artemis-instance
ENTRYPOINT ["/docker-run.sh"] ENTRYPOINT ["/docker-run.sh"]
CMD ["artemis-server"] CMD ["run"]

View File

@ -36,6 +36,6 @@ else
echo "broker already created, ignoring creation" echo "broker already created, ignoring creation"
fi fi
./bin/artemis run exec ./bin/artemis "$@"

View File

@ -29,7 +29,7 @@ error () {
echo "Usage: ./prepare-docker.sh ARTEMIS_HOME_LOCATION" echo "Usage: ./prepare-docker.sh ARTEMIS_HOME_LOCATION"
echo "" echo ""
echo "example:" echo "example:"
echo "./prepare-release.sh https://repo1.maven.org/maven2 2.5.0" echo "./prepare-docker.sh ../artemis-distribution/target/apache-artemis-2.7.0-SNAPSHOT-bin/apache-artemis-2.7.0-SNAPSHOT"
echo "" echo ""
exit 64 exit 64
} }
@ -51,6 +51,6 @@ then
rm -rf $target/docker rm -rf $target/docker
fi fi
mkdir $target/docker mkdir $target/docker
cp * $target/docker cp ./{Dockerfile-centos,Dockerfile-ubuntu,docker-run.sh} $target/docker
echo "Docker file support files at : $target/docker" echo "Docker file support files at : $target/docker"

View File

@ -1,4 +1,4 @@
# Docker Image Example * # Docker Image Example
This is an example on how you could create your own Docker Image For Apache ActiveMQ Artemis based on CentOS or Ubuntu. This is an example on how you could create your own Docker Image For Apache ActiveMQ Artemis based on CentOS or Ubuntu.
# Preparing # Preparing
@ -6,30 +6,30 @@ This is an example on how you could create your own Docker Image For Apache Acti
Use the script ./prepare-docker.sh as it will copy the docker files under the binary distribution. Use the script ./prepare-docker.sh as it will copy the docker files under the binary distribution.
``` ```
$ ./prepare.sh $ARTEMIS_HOME $ ./prepare-docker.sh $ARTEMIS_HOME
``` ```
# Building # Building
Go to $ARTEMIS_HOME where you prepared the binary with Docker files. Go to `$ARTEMIS_HOME` where you prepared the binary with Docker files.
## For Ubuntu: ## For Ubuntu:
From within the $ARTEMIS_HOME From within the `$ARTEMIS_HOME` folder:
``` ```
$ docker build -f ./docker/Dockerfile-ubuntu -t artemis-ubuntu . $ docker build -f ./docker/Dockerfile-ubuntu -t artemis-ubuntu .
``` ```
**Note:**
-t artemis-ubuntu` is just a tag name for the purpose of this guide
## For CentOS ## For CentOS
From within the binary distribution folder: From within the `$ARTEMIS_HOME` folder:
``` ```
$ docker build -f ./docker/Dockerfile-centos -t artemis-centos . $ docker build -f ./docker/Dockerfile-centos -t artemis-centos .
``` ```
**Note:**
`-t artemis-ubuntu`,`-t artemis-centos` are just tag names for the purpose of this guide
# Variables: # Variables:
- ARTEMIS_USER - ARTEMIS_USER
@ -40,15 +40,15 @@ Default here is FALSE. If you set this to true, it will change security settings
- CREATE_ARGUMENTS - CREATE_ARGUMENTS
Default here is " --user ${ARTEMIS_USER} --password ${ARTEMIS_PASSWORD} --silent --http-host 0.0.0.0 --relax-jolokia" Default here is `--user ${ARTEMIS_USER} --password ${ARTEMIS_PASSWORD} --silent --http-host 0.0.0.0 --relax-jolokia"`
This will be passed straight to ./artemis create during the execution. This will be passed straight to `./artemis create` during the execution.
# Mapping point # Mapping point
- /var/lib/artemis-instance - `/var/lib/artemis-instance`
It's possible to map a folder as the instance broker. It's possible to map a folder as the instance broker.
This will hold the configuration and the data of the running broker. This is useful for when you want the data persisted outside of a container. This will hold the configuration and the data of the running broker. This is useful for when you want the data persisted outside of a container.
@ -56,7 +56,7 @@ This will hold the configuration and the data of the running broker. This is use
# Lifecycle of the execution # Lifecycle of the execution
A broker instance will be created during the execution of the instance. If you pass a mapped folder for /var/lib/artemis-instance an image will be created or reused depending on the contents of the folder. A broker instance will be created during the execution of the instance. If you pass a mapped folder for `/var/lib/artemis-instance` an image will be created or reused depending on the contents of the folder.