-
Notifications
You must be signed in to change notification settings - Fork 51
/
setup_dockerized_app_on_fresh_machine.sh
executable file
·44 lines (34 loc) · 1.09 KB
/
setup_dockerized_app_on_fresh_machine.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
#!/bin/bash
# Update system packages
echo "Updating system packages..."
sudo apt-get update
# Install Docker
echo "Installing Docker..."
sudo apt-get install docker.io -y
# Start Docker service
echo "Starting Docker service..."
sudo systemctl start docker
# Display Docker version
echo "Checking Docker version..."
sudo docker --version
# Add the current user to the docker group
echo "Adding current user to the Docker group..."
sudo usermod -aG docker $USER
# Build the Docker image
echo "Building the Docker image..."
arch=$(uname -m)
base_image="ubuntu:latest"
if [ "$arch" = "x86_64" ]; then
echo "Building for x86_64..."
sudo docker build --build-arg BASE_IMAGE=$base_image --build-arg ARCH="amd64" -t swiss-army-llama .
elif [ "$arch" = "aarch64" ]; then
echo "Building for aarch64..."
sudo docker build --build-arg BASE_IMAGE=$base_image --build-arg ARCH="arm64" -t swiss-army-llama .
else
echo "Unsupported architecture."
exit 1
fi
# Run the Docker container
echo "Running the Docker container..."
sudo docker run -e TERM=$TERM -p 8089:8089 swiss-army-llama
echo "Script completed!"