Skip to content

fixed workflow file

fixed workflow file #7

Workflow file for this run

name: CICD
on:
push:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v3
- name: Login to Docker Hub
run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
- name: Copy .env file
run: cp .env .env.local
- name: Build Docker image
run: docker build -t jayantvashisth/furniturebackend --build-arg MONGODB_URI=${{ secrets.MONGODB_URI }} --build-arg PORT=${{ secrets.PORT }} .
- name: Push image to Docker Hub
run: docker push jayantvashisth/furniturebackend:latest
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: Pull image from Docker Hub
run: docker pull jayantvashisth/furniturebackend
- name: Delete old container (if exists)
run: docker rm -f furniture-container || true
- name: Run Docker container
run: docker run -d -p 5000:5000 --env-file .env.local --name furniture-container jayantvashisth/furniturebackend
# Add more steps for additional deployment tasks (e.g., database migrations, environment setup) if needed