Skip to content

figuring out how complexes match #39

figuring out how complexes match

figuring out how complexes match #39

name: DEVELOPMENT
on:
push:
branches:
- development
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
- name: Build and push Docker image
id: push
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
tags: jphuse/fundna_dev:latest
- name: Install SSH client
run: sudo apt-get install -y openssh-client
- name: Deploy Docker image to SSH server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
password: ${{ secrets.SSH_PASSWORD }}
port: ${{ secrets.SSH_PORT }}
script: |
# Ensure cron is installed and running
if ! command -v cron &> /dev/null
then
sudo apt-get update
sudo apt-get install -y cron
fi
sudo service cron start
# Log into Docker on the SSH Server
docker login -u jphuse -p ${{ secrets.DOCKER_ACCESS_TOKEN }}
# Remove the container if it exists
docker rm -f fundna_dev || true
# Pull the latest Docker image
docker pull jphuse/fundna_dev:latest
# Run the Docker container with environment variables
docker run -d --name fundna_dev \
--restart always \
--network=jphuse_network \
-e MYSQLHOST=${{ secrets.MYSQLHOST }} \
-e MYSQLPORT=${{ secrets.MYSQLPORT }} \
-e MYSQLUSER=${{ secrets.MYSQLUSER }} \
-e MYSQLPASSWORD=${{ secrets.MYSQLPASSWORD }} \
-e MYSQLDATABASE=${{ secrets.MYSQLDATABASE }} \
-e DJANGO_SETTINGS_MODULE=${{ secrets.DJANGO_SETTINGS_MODULE }} \
-e PYTHONUNBUFFERED=${{ secrets.PYTHONUNBUFFERED }} \
-e DJANGO_PORT=53307 \
-p 53307:53307 \
jphuse/fundna_dev:latest