- Next.js 16 app with React 19 and Tailwind CSS 4 - Multi-stage Dockerfile (node:20-alpine build → nginx:alpine runtime) - docker-compose.yml for container orchestration - nginx.conf for container-level configuration - GitHub Actions CI/CD workflow for automated deployment - .dockerignore and .gitignore configured Co-Authored-By: Paperclip <noreply@paperclip.ing>
64 lines
1.5 KiB
YAML
64 lines
1.5 KiB
YAML
name: Deploy hatch.surf
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
REGISTRY: ghcr.io
|
|
IMAGE_NAME: ${{ github.repository }}/hatch-web
|
|
|
|
jobs:
|
|
build-and-push:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Log in to Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Extract metadata
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
tags: |
|
|
type=sha
|
|
type=ref,event=branch
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
|
|
deploy:
|
|
needs: build-and-push
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Deploy to server
|
|
uses: appleboy/ssh-action@v1
|
|
with:
|
|
host: ${{ secrets.SERVER_HOST }}
|
|
username: ${{ secrets.SERVER_USER }}
|
|
key: ${{ secrets.SERVER_SSH_KEY }}
|
|
script: |
|
|
cd /home/nara/repos/hatch-surf
|
|
git pull origin main
|
|
docker compose pull
|
|
docker compose up -d --remove-orphans
|
|
docker system prune -f
|