feat: add build and deploy
All checks were successful
/ build-node (push) Successful in 51s
/ publish (push) Successful in 14s

This commit is contained in:
Matthew McKinnon 2024-09-21 14:07:19 +10:00
parent 7317211394
commit 53df1a8345
4 changed files with 5178 additions and 9 deletions

View File

@ -0,0 +1,59 @@
on: push
jobs:
build-node:
runs-on: ubuntu-latest
container:
image: catthehacker/ubuntu:act-latest
steps:
- name: checkout repo
uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
- name: Install Node Dependencies
run: npm ci
- name: Build 11ty Site
run: npm run build --if-present
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
registry: git.comprofix.com
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: ./
file: ./Dockerfile
push: true
tags: git.comprofix.com/mmckinnon/website-dev:latest
publish:
runs-on: ubuntu-latest
steps:
- name: checkout repo
uses: actions/checkout@v4
- name: Publish Website
run: |
mkdir ~/.ssh
echo "${{ secrets.SSH_KNOWN_HOSTS }}" >> ~/.ssh/known_hosts
chmod 644 ~/.ssh/known_hosts
eval $(ssh-agent -s)
ssh-add <(echo "${{ secrets.SSH_PRIVATE_KEY }}")
ssh administrator@comprofix.com "cd /opt/comprofix; docker compose down" || true
scp docker-compose.yml administrator@comprofix.com:/opt/comprofix
ssh administrator@comprofix.com "cd /opt/comprofix; docker compose pull; docker compose up -d"

1
.gitignore vendored
View File

@ -1,3 +1,2 @@
node_modules
package-lock.json
_site

View File

@ -1,18 +1,17 @@
---
version: '3'
services:
comprofix:
container_name: comprofix
image: registry.gitlab.comprofix.com/comprofix/website:latest
image: git.comprofix.com/mmckinnon/comprofix.com:latest
restart: unless-stopped
networks:
- traefik
- proxy
labels:
- traefik.enable=true
- traefik.http.routers.{{container_name}}.rule=Host(`comprofix.com`,`www.comprofix.com`)
- traefik.http.routers.{{container_name}}.entrypoints=https
- traefik.http.routers.{{container_name}}.tls.certresolver=cloudflare
- traefik.http.routers.comprofix.rule=Host(`comprofix.com`) || Host(`www.comprofix.com`)
- traefik.http.routers.comprofix.entrypoints=https
- traefik.http.routers.comprofix.tls=true
- traefik.http.services.comprofix.loadbalancer.server.port=80
networks:
traefik:
proxy:
external: true

5112
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff