Setup repo for local, dev and production

This commit is contained in:
2025-09-06 14:28:46 +10:00
parent 7a9a8a1f15
commit 898ad5e541
40 changed files with 236 additions and 64 deletions

View File

@ -0,0 +1,59 @@
name: Build and Deploy Development
on:
push:
branches:
- develop
jobs:
build-and-push:
runs-on: ubuntu-latest
env:
DOCKER_REGISTRY: git.comprofix.com
IMAGE_NAME: mmckinnon/comprofix.com
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:develop
build-args: |
HUGO_BASEURL=https://dev.comprofix.com/
deploy:
runs-on: ubuntu-latest
needs: build-and-push
env:
DEPLOY_USER: administrator
DEPLOY_HOST: docker.comprofix.xyz
DEPLOY_PATH: /opt/comprofix
steps:
- uses: actions/checkout@v4
- name: Deploy to development server
run: |
mkdir -p ~/.ssh
eval $(ssh-agent -s)
ssh-add <(echo "${{ secrets.SSH_PRIVATE_KEY }}")
echo "Uploading docker-compose.yml and .env.develop..."
scp docker-compose.yml $DEPLOY_USER@$DEPLOY_HOST:$DEPLOY_PATH
scp .env.develop $DEPLOY_USER@$DEPLOY_HOST:$DEPLOY_PATH/.env
echo "Deploying development container..."
ssh -o StrictHostKeyChecking=no $DEPLOY_USER@$DEPLOY_HOST "
cd $DEPLOY_PATH
docker compose --env-file .env up -d
"