add docker templates

This commit is contained in:
Bozhidar 2024-04-27 15:15:01 +03:00
parent 3be82bde08
commit ed2c7f1c43
10 changed files with 242 additions and 1 deletions

View file

@ -33,6 +33,14 @@ class DockerTemplateResource extends Resource
public static function form(Form $form): Form public static function form(Form $form): Form
{ {
$dockerTemplate = request()->get('docker_template', null);
try {
$dockerTemplateContent = file_get_contents(module_path('Docker', 'resources/views/docker-templates/' . $dockerTemplate . '.yml'));
} catch (\Exception $e) {
$dockerTemplateContent = '';
}
return $form return $form
->schema([ ->schema([
@ -45,6 +53,28 @@ class DockerTemplateResource extends Resource
->label('Description') ->label('Description')
->placeholder('Enter the description of the template'), ->placeholder('Enter the description of the template'),
Forms\Components\Select::make('docker_template')
->label('Docker Template')
->columnSpanFull()
->live()
->default($dockerTemplate)
->options([
'microweber' => 'Microweber',
'wordpress' => 'Wordpress',
// 'opencart' => 'Opencart',
'prestashop' => 'Prestashop',
// 'magento' => 'Magento',
'drupal' => 'Drupal',
'joomla' => 'Joomla',
'redis' => 'Redis',
'mysql' => 'Mysql',
'postgres' => 'Postgres',
'mongo' => 'Mongo',
])->afterStateUpdated(function (Forms\Get $get, Forms\Set $set, ?string $old, ?string $state) {
return redirect('/admin/docker/templates/create?docker_template=' . $state);
//$set('docker_compose', $state);
}),
// Forms\Components\Textarea::make('docker_compose') // Forms\Components\Textarea::make('docker_compose')
// ->label('Docker compose') // ->label('Docker compose')
@ -53,8 +83,10 @@ class DockerTemplateResource extends Resource
// ->placeholder('Enter the Dockerfile content'), // ->placeholder('Enter the Dockerfile content'),
AceEditor::make('docker_compose') AceEditor::make('docker_compose')
->mode('php') ->mode('yml')
->theme('github') ->theme('github')
->default($dockerTemplateContent)
->columnSpanFull()
->darkTheme('dracula'), ->darkTheme('dracula'),
]); ]);

View file

@ -0,0 +1,31 @@
version: '3.1'
services:
drupal:
image: drupal
restart: always
ports:
- 8080:80
environment:
DB_HOST: db
DB_USER: exampleuser
DB_PASSWORD: examplepass
DB_NAME: exampledb
volumes:
- drupal:/var/www/html
db:
image: mysql:8.0
restart: always
environment:
MYSQL_DATABASE: exampledb
MYSQL_USER: exampleuser
MYSQL_PASSWORD: examplepass
MYSQL_RANDOM_ROOT_PASSWORD: '1'
volumes:
- db:/var/lib/mysql
volumes:
drupal:
db:

View file

@ -0,0 +1,19 @@
version: '3.1'
services:
joomla:
image: joomla
restart: always
links:
- joomladb:mysql
ports:
- 8080:80
environment:
JOOMLA_DB_HOST: joomladb
JOOMLA_DB_PASSWORD: example
joomladb:
image: mysql:8.0
restart: always
environment:
MYSQL_ROOT_PASSWORD: example

View file

@ -0,0 +1,31 @@
version: '3.1'
services:
microweber:
image: microweber
restart: always
ports:
- 8080:80
environment:
DB_HOST: db
DB_USER: exampleuser
DB_PASSWORD: examplepass
DB_NAME: exampledb
volumes:
- microweber:/var/www/html
db:
image: mysql:8.0
restart: always
environment:
MYSQL_DATABASE: exampledb
MYSQL_USER: exampleuser
MYSQL_PASSWORD: examplepass
MYSQL_RANDOM_ROOT_PASSWORD: '1'
volumes:
- db:/var/lib/mysql
volumes:
microweber:
db:

View file

@ -0,0 +1,22 @@
# Use root/example as user/password credentials
version: '3.1'
services:
mongo:
image: mongo
restart: always
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: example
mongo-express:
image: mongo-express
restart: always
ports:
- 8081:8081
environment:
ME_CONFIG_MONGODB_ADMINUSERNAME: root
ME_CONFIG_MONGODB_ADMINPASSWORD: example
ME_CONFIG_MONGODB_URL: mongodb://root:example@mongo:27017/
ME_CONFIG_BASICAUTH: false

View file

@ -0,0 +1,15 @@
services:
mysql-db:
image: mysql:8.0
restart: always
environment:
MYSQL_DATABASE: exampledb
MYSQL_USER: exampleuser
MYSQL_PASSWORD: examplepass
MYSQL_RANDOM_ROOT_PASSWORD: '1'
volumes:
- db:/var/lib/mysql
volumes:
db:

View file

@ -0,0 +1,23 @@
version: '3.9'
services:
db:
image: postgres
restart: always
# set shared memory limit when using docker-compose
shm_size: 128mb
# or set shared memory limit when deploy via swarm stack
#volumes:
# - type: tmpfs
# target: /dev/shm
# tmpfs:
# size: 134217728 # 128*2^20 bytes = 128Mb
environment:
POSTGRES_PASSWORD: example
adminer:
image: adminer
restart: always
ports:
- 8080:8080

View file

@ -0,0 +1,31 @@
services:
prestashop:
image: prestashop/prestashop:latest
restart: always
ports:
- 8080:80
environment:
DB_HOST: db
DB_USER: exampleuser
DB_PASSWORD: examplepass
DB_NAME: exampledb
ADMIN_MAIL: exampledb@email.com
ADMIN_PASSWD: examplepass
volumes:
- prestashop:/var/www/html
db:
image: mysql:8.0
restart: always
environment:
MYSQL_DATABASE: exampledb
MYSQL_USER: exampleuser
MYSQL_PASSWORD: examplepass
MYSQL_RANDOM_ROOT_PASSWORD: '1'
volumes:
- db:/var/lib/mysql
volumes:
prestashop:
db:

View file

@ -0,0 +1,6 @@
version: '3.1'
services:
redis:
image: redis
restart: always

View file

@ -0,0 +1,31 @@
version: '3.1'
services:
wordpress:
image: wordpress
restart: always
ports:
- 8080:80
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_USER: exampleuser
WORDPRESS_DB_PASSWORD: examplepass
WORDPRESS_DB_NAME: exampledb
volumes:
- wordpress:/var/www/html
db:
image: mysql:8.0
restart: always
environment:
MYSQL_DATABASE: exampledb
MYSQL_USER: exampleuser
MYSQL_PASSWORD: examplepass
MYSQL_RANDOM_ROOT_PASSWORD: '1'
volumes:
- db:/var/lib/mysql
volumes:
wordpress:
db: