fernandohackbart / bikeride-lagom

Sample Bike Ride application backend to learn Lagom
Other
4 stars 2 forks source link

Build BikeRide containers #134

Closed fernandohackbart closed 7 years ago

fernandohackbart commented 7 years ago

Define the procedure to build the BikeRide containers

fernandohackbart commented 7 years ago
mkdir -p /opt/bikeride
cd /opt/bikeride
git clone https://github.com/fernandohackbart/bikeride-lagom.git
fernandohackbart commented 7 years ago
fernandohackbart commented 7 years ago
fernandohackbart commented 7 years ago
cd /opt/bikeride/bikeride-lagom

sbt <<EOF
project biker-lagom-impl
dist
exit
EOF
fernandohackbart commented 7 years ago
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
fernandohackbart commented 7 years ago
fernandohackbart commented 7 years ago

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
fernandohackbart commented 7 years ago

And it is working just fine!

fernandohackbart commented 7 years ago

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...

fernandohackbart commented 7 years ago

I really have to find a container management tool like DCOS or Openshift to help me out with those containers...