Skip to content

Commit

Permalink
Merge pull request #44 from investbrainapp/create-docker-image
Browse files Browse the repository at this point in the history
Use the investbrainapp/investbrain docker image
  • Loading branch information
hackeresq authored Dec 18, 2024
2 parents 3f9a1ba + 643bbe3 commit 997b542
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 66 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ QUEUE_CONNECTION=redis
CACHE_STORE=redis

REDIS_CLIENT=predis
REDIS_HOST=127.0.0.1
REDIS_HOST=investbrain-redis
REDIS_PATH=/tmp/database_server.sock
REDIS_PASSWORD=null
REDIS_PORT=6379
Expand Down
15 changes: 12 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ networks:
driver: bridge
services:
app:
build:
context: .
dockerfile: docker/Dockerfile
image: investbrainapp/investbrain:latest
container_name: investbrain-app
restart: unless-stopped
tty: true
Expand All @@ -15,8 +13,18 @@ services:
- .:/var/www/app:delegated
depends_on:
- mysql
- redis
networks:
- investbrain-network
redis:
image: redis:alpine
container_name: investbrain-redis
restart: unless-stopped
tty: true
networks:
- investbrain-network
volumes:
- investbrain-redis:/data
nginx:
image: nginx:alpine
container_name: investbrain-nginx
Expand Down Expand Up @@ -46,4 +54,5 @@ services:
networks:
- investbrain-network
volumes:
investbrain-redis:
investbrain-mysql:
1 change: 0 additions & 1 deletion docker/.gitignore

This file was deleted.

47 changes: 0 additions & 47 deletions docker/Dockerfile

This file was deleted.

18 changes: 14 additions & 4 deletions docker/entrypoint.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ if [ ! -f ".env" ]; then
cp .env.example .env
fi

echo "====================== Checking for updates... ====================== "
/usr/bin/git pull

echo "====================== Installing Composer dependencies... ====================== "
/usr/local/bin/composer install

Expand All @@ -38,7 +35,20 @@ echo "====================== Installing NPM dependencies and building frontend..
/usr/bin/npm run build

echo "====================== Running migrations... ====================== "
/usr/local/bin/php artisan migrate --force
run_migrations() {
/usr/local/bin/php artisan migrate --force
}
RETRIES=30
DELAY=5
until run_migrations; do
RETRIES=$((RETRIES-1))
if [ $RETRIES -le 0 ]; then
echo "Database is not ready after multiple attempts. Exiting..."
exit 1
fi
echo "Waiting for database to be ready... retrying in $DELAY seconds."
sleep $DELAY
done

echo "====================== Spinning up Supervisor daemon... ====================== "
exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf
2 changes: 0 additions & 2 deletions docker/redis.conf

This file was deleted.

7 changes: 0 additions & 7 deletions docker/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,6 @@ autorestart=true
stdout_logfile=/var/log/supervisor/php.log
stderr_logfile=/var/log/supervisor/php_error.log

[program:redis]
command=redis-server /var/www/app/docker/redis.conf
autostart=true
autorestart=true
stdout_logfile=/var/log/supervisor/redis.log
stderr_logfile=/var/log/supervisor/redis_error.log

[program:scheduler]
command=php artisan schedule:work
autorestart=true
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 997b542

Please sign in to comment.