-
Notifications
You must be signed in to change notification settings - Fork 55
/
Copy pathsetup-docker.py
53 lines (43 loc) · 1.15 KB
/
setup-docker.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/python3
import os
print('''
[?] what is the backend language you are commfortable with ? [ please select from given the options ]
[1]. php
[2]. python
[3]. nodejs
''')
lang=int(input("[>] enter options : "))
print("[+] you selected : ",lang)
os.system("mkdir backend")
if lang==1:
cont='''FROM php:7.0-apache
COPY ./var/www/php
EXPOSE 5000
'''
with open("backend/Dockerfile","w") as f:
f.write(cont)
print("\n[!] process complete")
elif lang==2:
cont='''FROM python:3-alpine
WORKDIR /backend
COPY requirements.txt ./
RUN pip install -r requirements.txt
COPY . .
EXPOSE 5000
CMD [ 'flask', 'run','--host','0.0.0.0','--port','5000']'''
with open("backend/Dockerfile","w") as f:
f.write(cont)
print("\n[!] process complete")
elif lang==3:
cont='''FROM node:16
COPY package.json package-lock.json $HOME/node_docker/
WORKDIR .
RUN npm install --silent --progress=false
EXPOSE 5000
CMD ["npm", "start"]'''
with open("backend/Dockerfile","w") as f:
f.write(cont)
print("\n[!] process complete")
else:
print("\n[!] process failed")
print("[!] Please select a valid language.\nIf you cant develop with given options, please contact your mentor!")