Skip to content

Commit 5cd2146

Browse files
git commit -m 'assignment 2'
1 parent 4d95003 commit 5cd2146

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

.github/workflows/autodeploy.yml

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -61,22 +61,20 @@ jobs:
6161
- name: Build Docker Image
6262
run: |
6363
cd course-matrix
64-
# Build the frontend image
65-
docker compose -f docker-compose.yml build frontend
66-
docker tag frontend:latest course-matrix/frontend:latest # Tag frontend with the Docker Hub repository
67-
68-
# Build the backend image
69-
docker compose -f docker-compose.yml build backend
70-
docker tag backend:latest course-matrix/backend:latest # Tag backend with the Docker Hub repository
64+
docker compose build
65+
66+
- name: Tag Images
67+
run: |
68+
docker tag course-matrix/frontend:latest course-matrix/frontend:${{ github.sha }}
69+
docker tag course-matrix/backend:latest course-matrix/backend:${{ github.sha }}
7170
7271
# Step 5: Push Docker images to Docker Hub
7372
- name: Push Docker images to Docker Hub
7473
run: |
75-
# Push the frontend image
7674
docker push course-matrix/frontend:latest
77-
78-
# Push the backend image
75+
docker push course-matrix/frontend:${{ github.sha }}
7976
docker push course-matrix/backend:latest
77+
docker push course-matrix/backend:${{ github.sha }}
8078
8179
deploy:
8280
needs: test
@@ -95,7 +93,7 @@ jobs:
9593
run: |
9694
ssh -i private_key -o StrictHostKeyChecking=no ${{ secrets.GCP_USERNAME }}@${{ secrets.GCP_VM_IP }} << 'EOF'
9795
cd /home/masahisasekita/term-group-project-c01w25-project-course-matrix || { echo "Error: Directory /root/myapp does not exist!"; exit 1; }
98-
git pull ms/Scrun-130-Project-Deployment-dockerfiles
96+
git pull develop
9997
cd course-matrix
10098
10199
# Update frontend .env

0 commit comments

Comments
 (0)