feat: implements CRUD of users #24 (#29) #11
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: Deploy | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
push-to-registry: | |
name: Push to DockerHub Registry | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: "zulu" | |
- name: Login to DockerHub | |
run: echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin | |
- name: Build and push Docker image | |
run: | | |
docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/mandacarubroker-api . | |
docker push ${{ secrets.DOCKERHUB_USERNAME }}/mandacarubroker-api | |
deploy: | |
needs: push-to-registry | |
name: Deploy to Azure VM | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Azure CLI | |
uses: azure/login@v1 | |
with: | |
creds: ${{ secrets.AZURE_CREDENTIALS }} | |
- name: Connect to Azure VM and run Docker Compose | |
run: | | |
echo "${{ secrets.SSH_PRIVATE_KEY }}" > private_key | |
chmod 400 private_key | |
ssh -o StrictHostKeyChecking=no -i private_key [email protected] 'sudo docker stop mandacarubroker-api || true && docker rm mandacarubroker-api || true && docker run --log-opt labels=applications,environment --restart unless-stopped --name mandacarubroker-api --env-file=/home/william/mandacaru-broker-jandaia/.env -p 8080:8080 -d izaiasmachado/mandacarubroker-api' |