Skip to content

Updated git workflow attempt to fix error in push to docker hub #31

Updated git workflow attempt to fix error in push to docker hub

Updated git workflow attempt to fix error in push to docker hub #31

Workflow file for this run

name: Web App CI/CD
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Build and Test Web Application
run: |
cd web-app
docker build -t web-app .
docker run --rm web-app python -m unittest discover tests
push-to-docker-hub:
needs: build-and-test
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Build and Push Docker Image
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |
docker build -t your-docker-hub-username/your-image-name:latest .
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
docker push your-docker-hub-username/your-image-name:latest
deploy:
needs: push-to-docker-hub
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Deploy to Digital Ocean
run: |
# Add deployment steps for Digital Ocean