Skip to content

light update

light update #38

Workflow file for this run

name: Docker Image CI
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Login to Docker Registry
uses: docker/login-action@v1
with:
registry: ${{ secrets.REGISTRY_LINK }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ secrets.REGISTRY_LINK }}/portfolio:latest
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: executing remote ssh commands using password
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SERVER_IP }}
username: ${{ secrets.SERVER_USERNAME }}
password: ${{ secrets.SERVER_PASSWORD }}
script: |
echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login ${{ secrets.REGISTRY_LINK }} -u "${{ secrets.REGISTRY_USERNAME }}" --password-stdin
docker pull ${{ secrets.REGISTRY_LINK }}/portfolio:latest
docker stop portfolio
docker rm portfolio
docker run -d --name portfolio -p 4250:4250 -v /home/sberan/portfolio/data:/app/data --env DATABASE_URL="${{ secrets.DATABASE_URL }}" ${{ secrets.REGISTRY_LINK }}/portfolio:latest