Skip to content

update dockerfile

update dockerfile #3

Workflow file for this run

name: Deploy to Server
on:
push:
branches:
- main
jobs:
deploy:
name: Deploy to Server
runs-on: ubuntu-latest
steps:
- name: print
run: echo ${GITHUB_REF#refs/heads/}
- name: Git Checkout Latest
uses: actions/checkout@v2
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: |
syhdtmp/cosmos-explorer
tags: |
type=sha
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Install sshpass
run: |
sudo apt-get update
sudo apt-get install -y sshpass
- name: Deploy to VPS
run: |
sshpass -p ${{ secrets.SSH_PASSWORD }} ssh -o StrictHostKeyChecking=no ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} << EOF
sudo su
docker pull syhdtmp/cosmos-explorer:latest
docker run -d --name cosmos-explorer -p 5001:80 syhdtmp/cosmos-explorer:latest
EOF