Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: настроил простенькое развертывание докера на сервере #56

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,29 +1,12 @@
name: Lint
name: Build and Push Docker Images

on:
pull_request:
push:
branches:
- main
- dev
- develop

jobs:
eslint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- name: Install main deps
run: yarn
- name: Initialize
run: yarn lerna bootstrap
- name: Lint
run: yarn lint
- name: Test
run: yarn test

build-and-push:
permissions:
packages: write
Expand All @@ -32,11 +15,7 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: set lower case owner name
run: |
echo "OWNER_LC=${OWNER,,}" >>${GITHUB_ENV}
env:
OWNER: '${{ github.repository_owner }}'

- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
Expand All @@ -51,4 +30,4 @@ jobs:
file: .docker/server/Dockerfile
target: prod
push: true
tags: ghcr.io/${{ env.OWNER_LC }}/${{ github.event.repository.name }}/client:${{ github.sha }}
tags: ghcr.io/${{ env.OWNER_LC }}/${{ github.event.repository.name }}/client:${{ github.sha }}
29 changes: 29 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Deploy to Server

on:
push:
branches:
- main
- develop

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Deploy to server
uses: appleboy/[email protected]
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USER }}
key: ${{ secrets.SERVER_SSH_KEY }}
port: 22
script: |
cd /home/falcon-tanks/falcon-tanks
git pull origin develop
docker image prune --force
docker system prune --all --volumes --force
docker-compose down --volumes --remove-orphans
docker-compose up --build -d
25 changes: 25 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Lint and Test

on:
pull_request:
push:
branches:
- main
- develop

jobs:
eslint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- name: Install main deps
run: yarn
- name: Initialize
run: yarn lerna bootstrap
- name: Lint
run: yarn lint
- name: Test
run: yarn test
Loading