feat(docker): update bitrix service

add entrypoint script
add link bitrix and uploads to site
add build script
parent 9a2ebb38
...@@ -2,14 +2,15 @@ version: '2' ...@@ -2,14 +2,15 @@ version: '2'
services: services:
bitrix: bitrix:
image: zolotoykod/bitrix:latest image: zolotoykod/bitrix:latest
user: bitrix
working_dir: /home/bitrix/www
command: sudo /run.sh
volumes: volumes:
- bitrix:/home/bitrix/www/bitrix:Z - bitrix:/home/bitrix/www/bitrix:Z
- upload:/home/bitrix/www/upload:Z - upload:/home/bitrix/www/upload:Z
- data:/var/lib/mysql:Z - data:/var/lib/mysql:Z
- ./docker/zk-entrypoint.sh:/zk-entrypoint.sh:Z
- ./docker/link_bx.sh:/link_bx.sh:Z
- ./docker/build.sh:/build.sh:Z
- ./www:/home/bitrix/site:Z - ./www:/home/bitrix/site:Z
- ./docker/apache/bitrix.conf:/etc/httpd/bx/conf/default.conf:ro - ./docker/apache/bitrix.conf:/etc/httpd/bx/conf/default.conf:ro
...@@ -24,6 +25,8 @@ services: ...@@ -24,6 +25,8 @@ services:
environment: environment:
- HOME=/home/bitrix - HOME=/home/bitrix
- VIRTUAL_HOST - VIRTUAL_HOST
command: /bin/bash /zk-entrypoint.sh
working_dir: /home/bitrix
tty: true tty: true
volumes: volumes:
......
#!/bin/bash
(
cd /home/bitrix/site \
&& (
# Install dependencies
yarn install --no-progress --no-bin-links \
& composer update --no-progress \
& wait
) && (
# Build and migrations
gulp \
&& php migrator migrate
) && (
# Set permissions
chown -R bitrix.bitrix /home/bitrix/site
)
)
#!/bin/bash
DEST="$1"
DEV="$2"
if [ "$DEV" == "1" ]; then
cp -r /home/bitrix/www/bitrix $DEST
cp -r /home/bitrix/www/upload $DEST
else
ln -s /home/bitrix/www/bitrix $DEST
ln -s /home/bitrix/www/upload $DEST
fi
#!/bin/bash
# Modify bitrix user id and group id
if [ ! -z "$USER_ID" ]; then
usermod -u $USER_ID bitrix
fi
if [ ! -z "$GROUP_ID" ]; then
groupmod -g $GROUP_ID bitrix
fi
# Create symbolic links to bitrix and uploads
/bin/bash /link_bx.sh /home/bitrix/site
# Set permissions
chown -R bitrix.bitrix /home/bitrix
# Start server
/bin/bash /run.sh
<?
require($_SERVER["DOCUMENT_ROOT"]."/bitrix/header.php");
$APPLICATION->SetTitle("Главная");
?>
test
<?
require($_SERVER["DOCUMENT_ROOT"]."/bitrix/footer.php");
?>
#!/usr/bin/env php
<?php
require_once __DIR__ . '/vendor/autoload.php';
use Arrilot\BitrixMigrations\Commands\MakeCommand;
use Arrilot\BitrixMigrations\Commands\InstallCommand;
use Arrilot\BitrixMigrations\Commands\MigrateCommand;
use Arrilot\BitrixMigrations\Commands\RollbackCommand;
use Arrilot\BitrixMigrations\Commands\TemplatesCommand;
use Arrilot\BitrixMigrations\Commands\StatusCommand;
use Arrilot\BitrixMigrations\Migrator;
use Arrilot\BitrixMigrations\Storages\BitrixDatabaseStorage;
use Arrilot\BitrixMigrations\TemplatesCollection;
use Symfony\Component\Console\Application;
define("NOT_CHECK_PERMISSIONS", true);
$_SERVER["DOCUMENT_ROOT"] = __DIR__;
$DOCUMENT_ROOT = $_SERVER["DOCUMENT_ROOT"];
require $_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php";
CModule::IncludeModule("iblock");
$config = [
'table' => 'migrations',
'dir' => './migrations',
];
$database = new BitrixDatabaseStorage($config['table']);
$templates = new TemplatesCollection();
$templates->registerBasicTemplates();
$migrator = new Migrator($config, $templates, $database);
$app = new Application('Migrator');
$app->add(new MakeCommand($migrator));
$app->add(new InstallCommand($config['table'], $database));
$app->add(new MigrateCommand($migrator));
$app->add(new RollbackCommand($migrator));
$app->add(new TemplatesCommand($templates));
$app->add(new StatusCommand($migrator));
$app->run();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment