1
0
mirror of https://github.com/1C-Company/docker_fresh.git synced 2024-12-04 10:24:48 +02:00
docker_fresh/modules/site.py

50 lines
1.4 KiB
Python
Raw Permalink Normal View History

2020-04-05 15:06:36 +02:00
import modules.helper as helper
def delete_site_dir():
command = helper.new_docker_command('images/site/distr')
command.append('alpine')
command.append('rm')
command.append('-rf')
command.append('/out_files/site')
return command
def unzip_site_dir():
command = helper.new_docker_command()
2020-04-05 17:07:02 +02:00
command.append('-v')
command.append(helper.this_path + helper.replace_sep('images/site') + ':/main_dir')
2020-04-05 15:06:36 +02:00
command.append('kubeless/unzip')
command.append('unzip')
command.append('/out_files/site_*.zip')
command.append('-d')
2020-04-09 18:31:00 +02:00
command.append('/main_dir/distr/site')
2020-04-05 15:06:36 +02:00
return command
def rename_site_file():
command = helper.new_docker_command('images/site/distr')
command.append('alpine')
command.append('sh')
command.append('-c')
2020-07-21 16:49:06 +02:00
command.append('"mv /out_files/site/*.war /out_files/site/ROOT.war"')
2020-04-05 15:06:36 +02:00
return command
2020-04-05 17:07:02 +02:00
def add_all_before_commands():
2020-04-05 15:06:36 +02:00
commands = []
commands.append(unzip_site_dir())
commands.append(rename_site_file())
return commands
2020-04-05 17:07:02 +02:00
def add_all_after_commands():
commands = []
commands.append(delete_site_dir())
return commands
2020-04-05 15:06:36 +02:00
class New():
name = ''
2020-04-05 17:07:02 +02:00
commands_before = []
commands_after = []
2020-04-05 15:06:36 +02:00
def __init__(self):
self.name = 'site'
2020-04-05 17:07:02 +02:00
self.commands_before = add_all_before_commands()
self.commands_after = add_all_after_commands()