Use lightweight container images for CI/CD

This commit is contained in:
doomtube 2026-01-06 00:54:08 -05:00
parent b3682b1936
commit 8d8a23b65e
2 changed files with 24 additions and 5 deletions

View file

@ -3,6 +3,7 @@
# ============================================================================= # =============================================================================
# Triggers on push to main branch and pull requests # Triggers on push to main branch and pull requests
# Builds: backend, frontend, chat-service, openresty # Builds: backend, frontend, chat-service, openresty
# Uses docker:27-git (~50MB) instead of catthehacker/ubuntu (~1.5GB)
# ============================================================================= # =============================================================================
name: Build and Push name: Build and Push
@ -24,9 +25,12 @@ jobs:
# =========================================================================== # ===========================================================================
build-backend: build-backend:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container:
image: docker:27-git
options: --privileged
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: https://code.forgejo.org/actions/checkout@v4
- name: Login to Forgejo Registry - name: Login to Forgejo Registry
if: github.event_name == 'push' if: github.event_name == 'push'
@ -51,9 +55,12 @@ jobs:
# =========================================================================== # ===========================================================================
build-frontend: build-frontend:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container:
image: docker:27-git
options: --privileged
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: https://code.forgejo.org/actions/checkout@v4
- name: Login to Forgejo Registry - name: Login to Forgejo Registry
if: github.event_name == 'push' if: github.event_name == 'push'
@ -78,9 +85,12 @@ jobs:
# =========================================================================== # ===========================================================================
build-chat: build-chat:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container:
image: docker:27-git
options: --privileged
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: https://code.forgejo.org/actions/checkout@v4
- name: Login to Forgejo Registry - name: Login to Forgejo Registry
if: github.event_name == 'push' if: github.event_name == 'push'
@ -105,9 +115,12 @@ jobs:
# =========================================================================== # ===========================================================================
build-openresty: build-openresty:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container:
image: docker:27-git
options: --privileged
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: https://code.forgejo.org/actions/checkout@v4
- name: Login to Forgejo Registry - name: Login to Forgejo Registry
if: github.event_name == 'push' if: github.event_name == 'push'

View file

@ -3,6 +3,7 @@
# ============================================================================= # =============================================================================
# Triggers after successful build on main/master branch # Triggers after successful build on main/master branch
# SSHs to production server and updates containers # SSHs to production server and updates containers
# Uses alpine:3.19 (~7MB) instead of catthehacker/ubuntu (~1.5GB)
# ============================================================================= # =============================================================================
name: Deploy to Production name: Deploy to Production
@ -23,10 +24,15 @@ jobs:
# Only deploy if build succeeded OR manual trigger # Only deploy if build succeeded OR manual trigger
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }} if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
container:
image: alpine:3.19
steps: steps:
- name: Install dependencies
run: apk add --no-cache openssh-client curl git
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: https://code.forgejo.org/actions/checkout@v4
- name: Setup SSH key - name: Setup SSH key
run: | run: |