wip
This commit is contained in:
+5
-18
@@ -7,15 +7,16 @@ services:
|
|||||||
container_name: investbrain-app
|
container_name: investbrain-app
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
tty: true
|
tty: true
|
||||||
expose:
|
ports:
|
||||||
- "9000"
|
- "${APP_PORT:-8000}:80"
|
||||||
volumes:
|
|
||||||
- .:/var/www/app:delegated
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- mysql
|
- mysql
|
||||||
- redis
|
- redis
|
||||||
networks:
|
networks:
|
||||||
- investbrain-network
|
- investbrain-network
|
||||||
|
volumes:
|
||||||
|
- ./storage:/var/www/app/storage
|
||||||
|
- .env:/var/www/app/.env
|
||||||
redis:
|
redis:
|
||||||
image: redis:alpine
|
image: redis:alpine
|
||||||
container_name: investbrain-redis
|
container_name: investbrain-redis
|
||||||
@@ -25,20 +26,6 @@ services:
|
|||||||
- investbrain-network
|
- investbrain-network
|
||||||
volumes:
|
volumes:
|
||||||
- investbrain-redis:/data
|
- investbrain-redis:/data
|
||||||
nginx:
|
|
||||||
image: nginx:alpine
|
|
||||||
container_name: investbrain-nginx
|
|
||||||
restart: unless-stopped
|
|
||||||
tty: true
|
|
||||||
ports:
|
|
||||||
- "${APP_PORT:-8000}:80"
|
|
||||||
volumes:
|
|
||||||
- ./docker/nginx.conf:/etc/nginx/conf.d/default.conf
|
|
||||||
- .:/var/www/app:delegated
|
|
||||||
depends_on:
|
|
||||||
- app
|
|
||||||
networks:
|
|
||||||
- investbrain-network
|
|
||||||
mysql:
|
mysql:
|
||||||
image: mysql:8.0
|
image: mysql:8.0
|
||||||
container_name: investbrain-mysql
|
container_name: investbrain-mysql
|
||||||
|
|||||||
+22
-11
@@ -6,40 +6,51 @@ ENV DEBIAN_FRONTEND=noninteractive
|
|||||||
COPY . /var/www/app
|
COPY . /var/www/app
|
||||||
WORKDIR /var/www/app
|
WORKDIR /var/www/app
|
||||||
|
|
||||||
|
# Install Composer and Node.js
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
curl \
|
||||||
|
unzip \
|
||||||
|
git \
|
||||||
|
nodejs \
|
||||||
|
npm \
|
||||||
|
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
||||||
|
|
||||||
|
# Install PHP dependencies
|
||||||
|
RUN composer install --no-scripts --optimize-autoloader
|
||||||
|
|
||||||
|
# Install Node dependencies and build assets
|
||||||
|
RUN npm install && npm run build
|
||||||
|
|
||||||
# Set permissions
|
# Set permissions
|
||||||
RUN chown -R www-data:www-data . \
|
RUN chown -R www-data:www-data . \
|
||||||
&& chmod -R 775 ./storage \
|
|
||||||
&& chmod +x ./docker/entrypoint.sh \
|
&& chmod +x ./docker/entrypoint.sh \
|
||||||
# Install common php extension dependencies
|
# Install common php extension dependencies
|
||||||
&& apt-get update && apt-get install -y \
|
&& apt-get update && apt-get install -y \
|
||||||
|
nginx \
|
||||||
libfreetype-dev \
|
libfreetype-dev \
|
||||||
libjpeg62-turbo-dev \
|
libjpeg62-turbo-dev \
|
||||||
libpng-dev \
|
libpng-dev \
|
||||||
zlib1g-dev \
|
zlib1g-dev \
|
||||||
libzip-dev \
|
libzip-dev \
|
||||||
unzip \
|
|
||||||
libicu-dev \
|
libicu-dev \
|
||||||
git \
|
|
||||||
curl \
|
|
||||||
supervisor \
|
supervisor \
|
||||||
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
|
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
|
||||||
|
&& docker-php-ext-configure zip \
|
||||||
&& docker-php-ext-install -j$(nproc) \
|
&& docker-php-ext-install -j$(nproc) \
|
||||||
gd \
|
gd \
|
||||||
zip \
|
zip \
|
||||||
pdo_mysql \
|
pdo_mysql \
|
||||||
mysqli \
|
mysqli \
|
||||||
intl \
|
intl \
|
||||||
# Install Node.js and npm
|
# remove default nginx config
|
||||||
&& curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
|
&& rm /etc/nginx/sites-enabled/default
|
||||||
&& apt-get install -y nodejs \
|
|
||||||
&& npm install -g npm@latest
|
# Copy the custom Nginx configuration
|
||||||
|
COPY ./docker/nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
|
|
||||||
# Copy over supervisor configuration
|
# Copy over supervisor configuration
|
||||||
COPY ./docker/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
COPY ./docker/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||||||
|
|
||||||
# Install composer
|
|
||||||
COPY --from=composer:2.6.5 /usr/bin/composer /usr/local/bin/composer
|
|
||||||
|
|
||||||
# Serve on port 80
|
# Serve on port 80
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|
||||||
|
|||||||
@@ -9,15 +9,7 @@ if [ ! -f ".env" ]; then
|
|||||||
cp .env.example .env
|
cp .env.example .env
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "\n====================== Installing Composer dependencies... ====================== "
|
|
||||||
/usr/local/bin/composer install
|
|
||||||
|
|
||||||
echo -e "\n====================== Validating environment... ====================== "
|
echo -e "\n====================== Validating environment... ====================== "
|
||||||
if [ $(stat -c '%U' .) != "www-data" ]; then
|
|
||||||
echo " > Setting correct permissions for pwd..."
|
|
||||||
chown -R www-data:www-data .
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ( ! grep -q "^APP_KEY=" ".env" || grep -q "^APP_KEY=$" ".env"); then
|
if ( ! grep -q "^APP_KEY=" ".env" || grep -q "^APP_KEY=$" ".env"); then
|
||||||
echo " > Ah, APP_KEY is missing in .env file. Generating a new key!"
|
echo " > Ah, APP_KEY is missing in .env file. Generating a new key!"
|
||||||
|
|
||||||
@@ -30,10 +22,6 @@ if [ ! -L "public/storage" ]; then
|
|||||||
/usr/local/bin/php artisan storage:link
|
/usr/local/bin/php artisan storage:link
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "\n====================== Installing NPM dependencies and building frontend... ====================== "
|
|
||||||
/usr/bin/npm install
|
|
||||||
/usr/bin/npm run build
|
|
||||||
|
|
||||||
echo -e "\n====================== Running migrations... ====================== "
|
echo -e "\n====================== Running migrations... ====================== "
|
||||||
run_migrations() {
|
run_migrations() {
|
||||||
/usr/local/bin/php artisan migrate --force
|
/usr/local/bin/php artisan migrate --force
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@ server {
|
|||||||
fastcgi_param HTTPS $http_x_forwarded_proto;
|
fastcgi_param HTTPS $http_x_forwarded_proto;
|
||||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||||
fastcgi_pass investbrain-app:9000;
|
fastcgi_pass 127.0.0.1:9000;
|
||||||
}
|
}
|
||||||
|
|
||||||
location ~ /\.ht {
|
location ~ /\.ht {
|
||||||
|
|||||||
@@ -4,6 +4,13 @@ user=root
|
|||||||
logfile=/var/log/supervisor/supervisord.log
|
logfile=/var/log/supervisor/supervisord.log
|
||||||
pidfile=/var/run/supervisord.pid
|
pidfile=/var/run/supervisord.pid
|
||||||
|
|
||||||
|
[program:nginx]
|
||||||
|
command=nginx -g 'daemon off;'
|
||||||
|
autostart=true
|
||||||
|
autorestart=true
|
||||||
|
stderr_logfile=/var/log/nginx/error.log
|
||||||
|
stdout_logfile=/var/log/nginx/access.log
|
||||||
|
|
||||||
[program:php]
|
[program:php]
|
||||||
command=php-fpm -F
|
command=php-fpm -F
|
||||||
autostart=true
|
autostart=true
|
||||||
|
|||||||
Reference in New Issue
Block a user