Spaces:
Runtime error
Runtime error
Soutrik
commited on
Commit
·
3cdf230
1
Parent(s):
03beb83
added deployment yaml file
Browse files- .github/workflows/deploy.yml +39 -0
- install_docker.md +22 -0
.github/workflows/deploy.yml
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: Deploy to ECR and Run Docker Compose
|
2 |
+
|
3 |
+
on:
|
4 |
+
push:
|
5 |
+
branches:
|
6 |
+
- main
|
7 |
+
- feat/framework-setup
|
8 |
+
|
9 |
+
jobs:
|
10 |
+
deploy:
|
11 |
+
runs-on: self-hosted
|
12 |
+
|
13 |
+
steps:
|
14 |
+
- name: Checkout repository
|
15 |
+
uses: actions/checkout@v3
|
16 |
+
|
17 |
+
- name: Set up Docker Buildx
|
18 |
+
uses: docker/setup-buildx-action@v2
|
19 |
+
|
20 |
+
- name: Log in to Amazon ECR
|
21 |
+
env:
|
22 |
+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
23 |
+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
24 |
+
AWS_REGION: ${{ secrets.AWS_REGION }}
|
25 |
+
run: |
|
26 |
+
aws ecr get-login-password --region $AWS_REGION | docker login --username AWS --password-stdin 007758426687.dkr.ecr.$AWS_REGION.amazonaws.com
|
27 |
+
|
28 |
+
- name: Build Docker image
|
29 |
+
run: |
|
30 |
+
docker build -t soutrik71/test .
|
31 |
+
docker tag soutrik71/test:latest 007758426687.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com/soutrik71/test:latest
|
32 |
+
|
33 |
+
- name: Push to Amazon ECR
|
34 |
+
run: |
|
35 |
+
docker push 007758426687.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com/soutrik71/test:latest
|
36 |
+
|
37 |
+
- name: Run Docker Compose
|
38 |
+
run: |
|
39 |
+
docker-compose up -d --build app
|
install_docker.md
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
**Install docker and docker-compose on Ubuntu 22.04**
|
2 |
+
|
3 |
+
Install docker
|
4 |
+
```bash
|
5 |
+
sudo apt update
|
6 |
+
sudo apt install -y apt-transport-https ca-certificates curl software-properties-common
|
7 |
+
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
|
8 |
+
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
9 |
+
sudo apt update
|
10 |
+
sudo apt install -y docker-ce
|
11 |
+
sudo systemctl start docker
|
12 |
+
sudo systemctl enable docker
|
13 |
+
sudo usermod -aG docker $USER
|
14 |
+
docker --version
|
15 |
+
```
|
16 |
+
Install docker-compose
|
17 |
+
```bash
|
18 |
+
sudo rm /usr/local/bin/docker-compose
|
19 |
+
sudo curl -L "https://github.com/docker/compose/releases/download/v2.10.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
|
20 |
+
sudo chmod +x /usr/local/bin/docker-compose
|
21 |
+
docker-compose --version
|
22 |
+
```
|