Skip to content

Commit

Permalink
Create docker.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
luwenlong0123 authored Nov 17, 2023
1 parent 310cd57 commit 72fa068
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Continuous Deployment

on:
push:
branches:
- main

jobs:
deploy:
runs-on: centos-7

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Docker
uses: actions/setup-docker@v2

- name: Build and push Docker image
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
docker buildx create --use
docker buildx build --platform linux/amd64,linux/arm64 -t whaleal/whaleal-lwltest .
docker push whaleal/whaleal-ops
- name: SSH and deploy to server
uses: appleboy/ssh-action@v2
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USERNAME }}
key: ${{ secrets.SERVER_SSH_KEY }}
script: |
docker stop ops-container || true
docker rm ops-container || true
docker pull whaleal/whaleal-ops:latest
docker run -d --name your-container-name -p 8080:8080 whaleal/whaleal-ops:latest

0 comments on commit 72fa068

Please sign in to comment.