-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetupanddeploy.sh
46 lines (27 loc) · 1.07 KB
/
setupanddeploy.sh
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
#!/bin/bash
echo "Updating package lists..."
sudo apt-get update
echo "Installing nginx..."
sudo apt-get install -y nginx
echo "Enabling UFW firewall..."
sudo ufw enable
echo "Configuring UFW firewall..."
sudo ufw allow ssh
sudo ufw allow http
sudo ufw allow https
sudo ufw status
echo "Installing Docker..."
sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install -y docker-ce
echo "Copying default.conf to /etc/nginx/sites-available/default..."
sudo cp $(dirname "$0")/nginx/default.conf /etc/nginx/sites-available/default
echo "Restarting nginx..."
sudo systemctl restart nginx
echo "Building Docker image..."
sudo docker build --build-arg PORT=9000 -t proxyapp .
echo "Running Docker container..."
sudo docker run -d -p 9000:9000 --name proxyapp_container proxyapp
echo "All tasks completed successfully!"