Skip to content

fix: resolve docker-compose errors for CI Pipeline #3

fix: resolve docker-compose errors for CI Pipeline

fix: resolve docker-compose errors for CI Pipeline #3

Workflow file for this run

name: Pull and Deploy Docker Container & Run Automated Tests | CD Pipeline
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Pull Docker images
run: |
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/cscc01-linkup_frontend:latest
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/cscc01-linkup_backend:latest
- name: Deploy Containers
run: |
docker stop frontend || true
docker rm frontend || true
docker stop backend || true
docker rm backend || true
docker run -d --name frontend -p 80:3000 ${{ secrets.DOCKERHUB_USERNAME }}/cscc01-linkup_frontend:latest
docker run -d --name backend -p 5000:5000 ${{ secrets.DOCKERHUB_USERNAME }}/cscc01-linkup_backend:latest
- name: Run Automated Tests
run: |
docker exec backend npm test # Adjust this command to run your tests