add steps to build container images and push to private dockerhub repo #1
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Continuous Integration | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
jobs: | |
build-and-test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Build and run tests | |
run: | | |
docker-compose -f compose.test.yaml up --build -d | |
docker-compose -f compose.test.yaml run web_scraper pytest | |
docker-compose -f compose.test.yaml run api pytest | |
- name: Clean up | |
run: docker-compose -f compose.test.yaml down | |
deploy: | |
needs: build-and-test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Build Docker images | |
run: docker-compose build | |
- name: Login to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
- name: Tag and Push Images | |
run: | | |
docker tag roman_coins_data_pipeline_web_scraper ${{ secrets.DOCKER_HUB_USERNAME }}/roman-coins-data-pipeline:web_scraper-${{ github.sha }} | |
docker push ${{ secrets.DOCKER_HUB_USERNAME }}/roman-coins-data-pipeline:web_scraper-${{ github.sha }} | |
docker tag roman_coins_data_pipeline_api ${{ secrets.DOCKER_HUB_USERNAME }}/roman-coins-data-pipeline:api-${{ github.sha }} | |
docker push ${{ secrets.DOCKER_HUB_USERNAME }}/roman-coins-data-pipeline:api-${{ github.sha }} |