Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 997b5420ee | |||
| 643bbe3af2 | |||
| f85f0f19b9 |
+1
-1
@@ -52,7 +52,7 @@ QUEUE_CONNECTION=redis
|
|||||||
CACHE_STORE=redis
|
CACHE_STORE=redis
|
||||||
|
|
||||||
REDIS_CLIENT=predis
|
REDIS_CLIENT=predis
|
||||||
REDIS_HOST=127.0.0.1
|
REDIS_HOST=investbrain-redis
|
||||||
REDIS_PATH=/tmp/database_server.sock
|
REDIS_PATH=/tmp/database_server.sock
|
||||||
REDIS_PASSWORD=null
|
REDIS_PASSWORD=null
|
||||||
REDIS_PORT=6379
|
REDIS_PORT=6379
|
||||||
|
|||||||
+12
-3
@@ -3,9 +3,7 @@ networks:
|
|||||||
driver: bridge
|
driver: bridge
|
||||||
services:
|
services:
|
||||||
app:
|
app:
|
||||||
build:
|
image: investbrainapp/investbrain:latest
|
||||||
context: .
|
|
||||||
dockerfile: docker/Dockerfile
|
|
||||||
container_name: investbrain-app
|
container_name: investbrain-app
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
tty: true
|
tty: true
|
||||||
@@ -15,8 +13,18 @@ services:
|
|||||||
- .:/var/www/app:delegated
|
- .:/var/www/app:delegated
|
||||||
depends_on:
|
depends_on:
|
||||||
- mysql
|
- mysql
|
||||||
|
- redis
|
||||||
networks:
|
networks:
|
||||||
- investbrain-network
|
- investbrain-network
|
||||||
|
redis:
|
||||||
|
image: redis:alpine
|
||||||
|
container_name: investbrain-redis
|
||||||
|
restart: unless-stopped
|
||||||
|
tty: true
|
||||||
|
networks:
|
||||||
|
- investbrain-network
|
||||||
|
volumes:
|
||||||
|
- investbrain-redis:/data
|
||||||
nginx:
|
nginx:
|
||||||
image: nginx:alpine
|
image: nginx:alpine
|
||||||
container_name: investbrain-nginx
|
container_name: investbrain-nginx
|
||||||
@@ -46,4 +54,5 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
- investbrain-network
|
- investbrain-network
|
||||||
volumes:
|
volumes:
|
||||||
|
investbrain-redis:
|
||||||
investbrain-mysql:
|
investbrain-mysql:
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
dump.rdb
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
FROM php:8.3-fpm
|
|
||||||
|
|
||||||
ENV DEBIAN_FRONTEND noninteractive
|
|
||||||
|
|
||||||
# Set the working directory
|
|
||||||
COPY . /var/www/app
|
|
||||||
WORKDIR /var/www/app
|
|
||||||
|
|
||||||
# Install common php extension dependencies
|
|
||||||
RUN apt-get update && apt-get install -y \
|
|
||||||
libfreetype-dev \
|
|
||||||
libjpeg62-turbo-dev \
|
|
||||||
libpng-dev \
|
|
||||||
zlib1g-dev \
|
|
||||||
libzip-dev \
|
|
||||||
unzip \
|
|
||||||
libicu-dev \
|
|
||||||
git \
|
|
||||||
curl \
|
|
||||||
redis \
|
|
||||||
supervisor \
|
|
||||||
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
|
|
||||||
&& docker-php-ext-install -j$(nproc) \
|
|
||||||
gd \
|
|
||||||
zip \
|
|
||||||
pdo_mysql \
|
|
||||||
mysqli \
|
|
||||||
intl
|
|
||||||
|
|
||||||
# Install Node.js and npm
|
|
||||||
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
|
|
||||||
&& apt-get install -y nodejs \
|
|
||||||
&& npm install -g npm@latest
|
|
||||||
|
|
||||||
# Copy over supervisor configuration
|
|
||||||
COPY ./docker/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
|
||||||
|
|
||||||
# Update permissions
|
|
||||||
RUN chown -R www-data:www-data . \
|
|
||||||
&& chmod -R 775 ./storage \
|
|
||||||
&& chmod +x ./docker/entrypoint.sh
|
|
||||||
|
|
||||||
# install composer
|
|
||||||
COPY --from=composer:2.6.5 /usr/bin/composer /usr/local/bin/composer
|
|
||||||
|
|
||||||
# Run everything else
|
|
||||||
CMD ["./docker/entrypoint.sh"]
|
|
||||||
Executable → Regular
+13
-3
@@ -9,9 +9,6 @@ if [ ! -f ".env" ]; then
|
|||||||
cp .env.example .env
|
cp .env.example .env
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "====================== Checking for updates... ====================== "
|
|
||||||
/usr/bin/git pull
|
|
||||||
|
|
||||||
echo "====================== Installing Composer dependencies... ====================== "
|
echo "====================== Installing Composer dependencies... ====================== "
|
||||||
/usr/local/bin/composer install
|
/usr/local/bin/composer install
|
||||||
|
|
||||||
@@ -38,7 +35,20 @@ echo "====================== Installing NPM dependencies and building frontend..
|
|||||||
/usr/bin/npm run build
|
/usr/bin/npm run build
|
||||||
|
|
||||||
echo "====================== Running migrations... ====================== "
|
echo "====================== Running migrations... ====================== "
|
||||||
|
run_migrations() {
|
||||||
/usr/local/bin/php artisan migrate --force
|
/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... ====================== "
|
echo "====================== Spinning up Supervisor daemon... ====================== "
|
||||||
exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf
|
exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
# Redis RDB and AOF file location
|
|
||||||
dir /var/www/app/docker
|
|
||||||
@@ -11,13 +11,6 @@ autorestart=true
|
|||||||
stdout_logfile=/var/log/supervisor/php.log
|
stdout_logfile=/var/log/supervisor/php.log
|
||||||
stderr_logfile=/var/log/supervisor/php_error.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]
|
[program:scheduler]
|
||||||
command=php artisan schedule:work
|
command=php artisan schedule:work
|
||||||
autorestart=true
|
autorestart=true
|
||||||
|
|||||||
Generated
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "investbrain",
|
"name": "app",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
|
|||||||
Reference in New Issue
Block a user