-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
64 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
version: 0.0 | ||
os: linux | ||
files: | ||
- source: / | ||
destination: /home/ubuntu/app | ||
hooks: | ||
BeforeInstall: | ||
- location: deploy/scripts/install_dependencies.sh | ||
timeout: 300 | ||
runas: ubuntu | ||
ApplicationStart: | ||
- location: deploy/scripts/start_docker.sh | ||
timeout: 300 | ||
runas: ubuntu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
|
||
# Ensure that the script runs in non-interactive mode | ||
export DEBIAN_FRONTEND=noninteractive | ||
|
||
# Update the package lists | ||
sudo apt-get update -y | ||
|
||
# Install Docker | ||
sudo apt-get install -y docker.io | ||
|
||
# Start and enable Docker service | ||
sudo systemctl start docker | ||
sudo systemctl enable docker | ||
|
||
# Install necessary utilities | ||
sudo apt-get install -y unzip curl | ||
|
||
# Download and install AWS CLI | ||
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "/home/ubuntu/awscliv2.zip" | ||
unzip -o /home/ubuntu/awscliv2.zip -d /home/ubuntu/ | ||
sudo /home/ubuntu/aws/install | ||
|
||
# Add 'ubuntu' user to the 'docker' group to run Docker commands without 'sudo' | ||
sudo usermod -aG docker ubuntu | ||
|
||
# Clean up the AWS CLI installation files | ||
rm -rf /home/ubuntu/awscliv2.zip /home/ubuntu/aws |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
# Login to AWS ECR | ||
aws ecr get-login-password --region ap-southeast-2 | docker login --username AWS --password-stdin 843369994444.dkr.ecr.eu-north-1.amazonaws.com/text-classification:v3 | ||
|
||
# Pull the latest image | ||
docker pull 843369994444.dkr.ecr.eu-north-1.amazonaws.com/text-classification:v3 | ||
|
||
# Check if the container 'campusx-app' is running | ||
if [ "$(docker ps -q -f name=text-classification)" ]; then | ||
# Stop the running container | ||
docker stop text-classification | ||
fi | ||
|
||
# Check if the container 'campusx-app' exists (stopped or running) | ||
if [ "$(docker ps -aq -f name=text-classification)" ]; then | ||
# Remove the container if it exists | ||
docker rm text-classification | ||
fi | ||
|
||
# Run a new container | ||
docker run -d -p 80:5000 -e DAGSHUB_PAT=319a47e590ec9cc01014f4b6e8805468766d0757 --name text-classification 843369994444.dkr.ecr.eu-north-1.amazonaws.com/text-classification:v3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters