description project :blub: #25
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/CD | |
# on: | |
# push: | |
# branches: | |
# - main | |
# - dev | |
# pull_request: | |
# branches: | |
# - main | |
jobs: | |
train: | |
name: RUN Train and Push To Docker | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Build Docker Image and Run Tests and Train | |
run: | | |
docker build . --file Dockerfile --tag ammarmoulla/machine_translate:v1 | |
docker run --name e2e ammarmoulla/machine_translate:v1 | |
docker start e2e | |
docker commit e2e ammarmoulla/lang:v1 | |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | |
docker push ammarmoulla/lang:v1 | |
- name: Send Telegram notification | |
run: | | |
curl -X POST "https://api.telegram.org/bot${{ secrets.AUTH_Telegram }}/sendMessage" \ | |
-d "chat_id=${{secrets.CHAT_ID}}" \ | |
-d "text=Train is Done!! and Push New image to DockerHub 😎" | |
deploy: | |
name: RUN Web Serivce | |
runs-on: ubuntu-latest | |
needs: [train] | |
steps: | |
- name: Pull and UP Server Production | |
run: | | |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | |
docker pull ammarmoulla/lang:v1 | |
docker run --entrypoint "sh" ammarmoulla/lang:v1 ./fastapi/start.sh |