Skip to content

feat: docker deploy #71

feat: docker deploy

feat: docker deploy #71

Workflow file for this run

name: Docker Build
# 1.1.0
# klsafjdl
# 2023-04-27-12-00-klsafjdl
on:
push:
branches: [master]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Login to DockerHub Registry
run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
- name: Build Docker image
run: docker build -t dmitrydorofeev/godeploy:${GITHUB_SHA::8} .
- name: Push the image
run: docker push dmitrydorofeev/godeploy:${GITHUB_SHA::8}
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: pull docker image
uses: appleboy/ssh-action@master
with:
envs: GITHUB_SHA
host: 37.139.41.28
username: ubuntu
key: ${{ secrets.PRIVATE_KEY }}
script: sudo docker pull dmitrydorofeev/godeploy:${GITHUB_SHA::8}
- name: deploy docker image
uses: appleboy/ssh-action@master
with:
envs: GITHUB_SHA
host: 37.139.41.28
username: ubuntu
key: ${{ secrets.PRIVATE_KEY }}
script: |
sudo docker rm -f $(sudo docker ps -aq)
sudo docker run -e VERSION=${GITHUB_SHA::8} -d -p 8080:8080 dmitrydorofeev/godeploy:${GITHUB_SHA::8}