samuel-ng: Add all used datasets and Notebook #54
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: CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
# Build and Deploy | |
jobs: | |
build-production: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Login to docker hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{secrets.CI_DOCKER_USERNAME}} | |
password: ${{secrets.CI_DOCKER_PASSWORD}} | |
- name: Build the docker image | |
run: | | |
ls -la | |
docker build . -f Dockerfile -t ${{ secrets.CI_DOCKER_USERNAME }}/${{ secrets.APP_NAME }}:${{ github.sha }} | |
- name: Push the docker image | |
run: | | |
docker push ${{ secrets.CI_DOCKER_USERNAME }}/${{ secrets.APP_NAME }}:${{ github.sha }} | |
deploy-production: | |
runs-on: ubuntu-latest | |
needs: build-production | |
steps: | |
- name: Deploy to Production | |
uses: appleboy/ssh-action@v0.1.7 | |
with: | |
host: ${{ secrets.SSH_HOST }} | |
username: ${{ secrets.USER_NAME }} | |
key: ${{ secrets.SERVER_PROD_KEY }} | |
script: | | |
echo '${{ secrets.CI_DOCKER_PASSWORD }}' | sudo docker login --username '${{ secrets.CI_DOCKER_USERNAME }}' --password-stdin; | |
sudo docker stop '${{ secrets.APP_NAME }}'; | |
sudo docker rm '${{ secrets.APP_NAME }}'; | |
sudo docker pull '${{ secrets.CI_DOCKER_USERNAME }}'/'${{ secrets.APP_NAME }}':'${{ github.sha }}'; | |
sudo docker run -d -p 5000:5000 --name "${{ secrets.APP_NAME }}" -e GOOGLE_MAP_API_KEY="${{ secrets.GOOGLE_MAP_API_KEY }}" -e DATABASE_URL="${{ secrets.DATABASE_URL }}" "${{ secrets.CI_DOCKER_USERNAME }}"/"${{ secrets.APP_NAME }}":"${{ github.sha }}"; | |
sudo docker system prune -a -f; | |
sudo docker logout; | |