Skip to content

Commit

Permalink
Adding Dockerfile #8
Browse files Browse the repository at this point in the history
  • Loading branch information
tilaks26 committed Jan 30, 2017
1 parent c6f65e3 commit a9cbb42
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 8 deletions.
12 changes: 10 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,17 @@ branches:
only:
- develop

sudo: false
sudo: required

install: true
services:
- docker

install:
- cd "laravel-portal"
- docker build -t tilaks/laravel-portal .
- docker ps -a
- docker login -e="$DOCKER_EMAIL" -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
- docker push tilaks/laravel-portal

before_deploy:
- pwd
Expand Down
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM php:5.6.29-apache

COPY laravel-develop/ /var/www/laravel-develop/

EXPOSE 8000
EXPOSE 8081
10 changes: 6 additions & 4 deletions scripts/before-install.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

echo 'Cleaning previous laravel directory if any'
sudo rm -fd /home/ec2-user/laravel-portal/ || true

Expand Down Expand Up @@ -50,12 +49,15 @@ if [ "$?" -ne 0 ]; then
sudo yum install -y docker-io
fi

echo 'Add current user to Docker group'
sudo usermod -aG docker $(whoami)

echo 'Starting Docker services'
sudo service docker start

echo 'Remove existing containers if any'
sudo docker ps -a | grep -w "laravel-container" | awk '{print $1}' | xargs --no-run-if-empty docker stop
sudo docker ps -a | grep -w "laravel-container" | awk '{print $1}' | xargs --no-run-if-empty docker rm
sudo docker ps -a | grep -w "laravel" | awk '{print $1}' | xargs --no-run-if-empty docker stop
sudo docker ps -a | grep -w "laravel" | awk '{print $1}' | xargs --no-run-if-empty docker rm

echo 'Remove existing images if any'
sudo docker images | grep -w "laravel-image" | awk '{print $3}' | xargs --no-run-if-empty docker rmi -f
sudo docker images | grep -w "tilaks/laravel-portal" | awk '{print $3}' | xargs --no-run-if-empty docker rmi -f
7 changes: 5 additions & 2 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ cd /home/ec2-user/
echo 'Move files to laravel-portal'
sudo mv app composer.json composer.lock gulpfile.js package.json routes tests appspec.yml install phpunit.xml scripts artisan config public server.php bootstrap database LICENSE resources storage laravel-portal/

echo 'Run Laravel'
php -S localhost:4000 &
echo 'Running Docker container'
sudo docker login -e="sneha.tilak26@gmail.com" -u="tilaks" -p="laravel"
sudo docker pull tilaks/laravel-portal
sudo docker images | grep '<none>' | awk '{print $3}' | xargs --no-run-if-empty docker rmi -f
sudo docker run -d -p 8081:8000 --name laravel $(docker images | grep -w "tilaks/laravel-portal" | awk '{print $3}') >> /var/log/laravel.log 2>&1 &

0 comments on commit a9cbb42

Please sign in to comment.