Closed fernandohackbart closed 7 years ago
mkdir -p /opt/bikeride
cd /opt/bikeride
git clone https://github.com/fernandohackbart/bikeride-lagom.git
docker build -f /opt/bikeride/bikeride-lagom/Docker/bikeride-backend/Dockerfile -t bikeride/bikeride-backend:base /opt/bikeride/bikeride-lagom/Docker/bikeride-backend
FROM centos:7
MAINTAINER Fernando Hackbart<fhackbart@gmail.com>
ENV JAVA_HOME /usr/lib/jvm/java
RUN yum install -y java-1.8.0-openjdk.x86_64 java-1.8.0-openjdk-devel.x86_64 && \
yum clean all && \
groupadd bikeride && \
useradd -d /home/bikeride -g bikeride -s /bin/bash bikeride && \
echo bikeride:bikeride | chpasswd && \
mkdir -p /u01 && \
chmod a+xr /u01 && \
chown bikeride:bikeride -R /u01
cd /opt/bikeride/bikeride-lagom
sbt <<EOF
project biker-lagom-impl
dist
exit
EOF
mkdir -p /opt/bikeride/bikeride-lagom/Docker/biker-lagom-impl/files
cd /opt/bikeride/bikeride-lagom/Docker/biker-lagom-impl/files
cp ../../biker-lagom-impl/target/universal/biker-lagom-impl-0.0.1-SNAPSHOT.zip files
For now I am using the Jenkins job and by hand building the containers
First I do a sbt dist
export bundleVersion=0.0.1-SNAPSHOT
rm -rf Docker/authentication-lagom-impl/files
rm -rf Docker/biker-lagom-impl/files
rm -rf Docker/track-lagom-impl/files
rm -rf Docker/ride-lagom-impl/files
mkdir -p Docker/authentication-lagom-impl/files
mkdir -p Docker/biker-lagom-impl/files
mkdir -p Docker/track-lagom-impl/files
mkdir -p Docker/ride-lagom-impl/files
unzip -q authentication-lagom-impl/target/universal/authentication-lagom-impl-${bundleVersion}.zip -d Docker/authentication-lagom-impl/files
mv Docker/authentication-lagom-impl/files/authentication-lagom-impl-${bundleVersion} Docker/authentication-lagom-impl/files/authentication-lagom-impl
unzip -q biker-lagom-impl/target/universal/biker-lagom-impl-${bundleVersion}.zip -d Docker/biker-lagom-impl/files
mv Docker/biker-lagom-impl/files/biker-lagom-impl-${bundleVersion} Docker/biker-lagom-impl/files/biker-lagom-impl
unzip -q track-lagom-impl/target/universal/track-lagom-impl-${bundleVersion}.zip -d Docker/track-lagom-impl/files
mv Docker/track-lagom-impl/files/track-lagom-impl-${bundleVersion} Docker/track-lagom-impl/files/track-lagom-impl
unzip -q ride-lagom-impl/target/universal/ride-lagom-impl-${bundleVersion}.zip -d Docker/ride-lagom-impl/files
mv Docker/ride-lagom-impl/files/ride-lagom-impl-${bundleVersion} Docker/ride-lagom-impl/files/ride-lagom-impl
docker build -f Docker/authentication-lagom-impl/Dockerfile -t bikeride/authentication-lagom-impl:${bundleVersion} Docker/authentication-lagom-impl
docker build -f Docker/biker-lagom-impl/Dockerfile -t bikeride/biker-lagom-impl:${bundleVersion} Docker/biker-lagom-impl
docker build -f Docker/track-lagom-impl/Dockerfile -t bikeride/track-lagom-impl:${bundleVersion} Docker/track-lagom-impl
docker build -f Docker/ride-lagom-impl/Dockerfile -t bikeride/ride-lagom-impl:${bundleVersion} Docker/ride-lagom-impl
And it is working just fine!
To run the containers I am using the following commands:
docker run -d --name authentication1 --network bikeride-network --ip 172.18.0.41 --dns=172.18.0.100 bikeride/authentication-lagom-impl:0.0.1-SNAPSHOT
docker run -d --name biker1 --network bikeride-network --ip 172.18.0.31 --dns=172.18.0.100 bikeride/biker-lagom-impl:0.0.1-SNAPSHOT
docker run -d --name ride1 --network bikeride-network --ip 172.18.0.61 --dns=172.18.0.100 bikeride/ride-lagom-impl:0.0.1-SNAPSHOT
docker run -d --name track1 --network bikeride-network --ip 172.18.0.51 --dns=172.18.0.100 bikeride/track-lagom-impl:0.0.1-SNAPSHOT
The IP addresses should follow the DNS entries in the BIND container...
I really have to find a container management tool like DCOS or Openshift to help me out with those containers...
Define the procedure to build the BikeRide containers