docker updates #29
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Server Build & Push | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build_and_push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the repo | |
uses: actions/checkout@v2 | |
- name: Create env file | |
run: | | |
touch .env | |
echo "${{ secrets.SERVER_ENV_PROD }}" > .env | |
- name: Build image | |
run: docker compose -f docker-compose.yml build | |
- name: Deploy Stack | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
key: ${{ secrets.KEY }} | |
path: site | |
script: | | |
git clone https://github.com/SamuelSlavka/site.git 2> /dev/null | |
cd site | |
git pull | |
touch .env | |
echo "${{ secrets.SERVER_ENV_PROD }}" > .env | |
docker-compose pull | |
docker-compose up -d | |
docker-compose restart | |