Skip to content

Merge pull request #125 from ITZipProject/main #3

Merge pull request #125 from ITZipProject/main

Merge pull request #125 from ITZipProject/main #3

Workflow file for this run

name: Docker Image CI
on:
push:
branches: [ "release" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Login Dockerhub
env:
DOCKER_USERNAME: ${{secrets.DOCKERHUB_USERNAME}}
DOCKER_PASSWORD: ${{secrets.DOCKERHUB_PASSWORD}}
run: docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
- name: make .env
run: |
touch .env
echo "${{ secrets.SECRET_ENV}}" > .env
- name: Builder the Docker image
run: docker build -t ${{secrets.DOCKERHUB_USERNAME}}/ts-react-18-nextjs-14.2 .
- name: taging
run: docker tag ${{secrets.DOCKERHUB_USERNAME}}/ts-react-18-nextjs-14.2 ${{secrets.DOCKERHUB_USERNAME}}/ts-react-18-nextjs-14.2:latest
- name: Push to Dockerhub
run: docker push ${{secrets.DOCKERHUB_USERNAME}}/ts-react-18-nextjs-14.2:latest
- name: executing remote ssh commands using ssh key
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.SSH_KEY }}
port: 22
script: |
sudo docker-compose -f /home/ubuntu/itzip/docker-compose.yml down
sudo docker rmi itzip/ts-react-18-nextjs-14.2:latest
sudo docker-compose -f /home/ubuntu/itzip/docker-compose.yml up -d
sudo docker system prune -a -f