-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathdocker_customize.py
34 lines (34 loc) · 1.76 KB
/
docker_customize.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
try:
from colorama import Fore, Back, Style, init
except ImportError as e:
print(Fore.WHITE+Back.RED+"Docker Customize module failed: \n-> {}".format(e))
init(autoreset=True)
def docker_customize():
x = 't'
selection = str(input(Fore.WHITE+Back.ORANGE+"[ ?? ] Would you like to customize the docker container? [ ?? ] \n(y/n) ->")).lower()
if selection == 'y':
docker_file = open('./Dockerfile', 'w')
while x == 't':
stack = str(input(Fore.WHITE+Back.YELLOW+"[ ?? ] Which stack would you like to choose?\n"
"( 1 ) LAMP\n"
"( 2 ) MEAN\n"
"( 3 ) Original Setting[Installs Apache2 and Python3) [ ?? ]\n->"))
if stack == 1:
print(Fore.WHITE+Back.GREEN+"[*] Sticking with original OS, feel free to change this line,\n"
"FROM ubuntu:latest, to customize down to the OS of the container.")
magic = open('./data/LAMP', 'r')
mike = magic.readlines()
magic.close()
docker_file.writelines(''.join(mike))
x = 'f'
if stack == 2:
print(Fore.WHITE+Back.GREEN+"[*] Sticking with original OS, feel free to change this line,\n"
"FROM ubuntu:latest, to customize down to the OS of the container.")
magic = open('./data/MEAN', 'r')
mike = magic.readlines()
magic.close()
docker_file.writelines(''.join(mike))
x = 'f'
if stack == 3 or selection == 'n':
print(Fore.WHITE+Back.RED+"[**] No changes will be made to docker file, continuing! [**]")
x = 'f'