56 lines
1.6 KiB
YAML
56 lines
1.6 KiB
YAML
name: Build & Deploy NutriApp
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
build-and-deploy:
|
|
runs-on: rust-builder
|
|
steps:
|
|
- name: Install System Dependencies
|
|
run: |
|
|
apt-get update -qq && apt-get install -y -qq ca-certificates curl nodejs pkg-config libssl-dev
|
|
curl -fsSL https://download.docker.com/linux/static/stable/aarch64/docker-27.3.1.tgz | tar xz
|
|
cp docker/docker /usr/local/bin/
|
|
docker version
|
|
node --version
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 1
|
|
|
|
- name: Cache Cargo
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
target
|
|
key: cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
- name: Build Frontend (WASM con trunk)
|
|
run: |
|
|
rustup target add wasm32-unknown-unknown
|
|
cargo install trunk --locked
|
|
cd frontend
|
|
trunk build --release
|
|
|
|
- name: Build Backend (Rust)
|
|
run: cargo build --release -p nutriapp-backend
|
|
|
|
- name: Build & Push Docker image
|
|
env:
|
|
REGISTRY: k3s.proyectosjoel.com
|
|
IMAGE_TAG: ${{ gitea.sha }}
|
|
run: |
|
|
docker build -t $REGISTRY/nutriapp:$IMAGE_TAG -t $REGISTRY/nutriapp:latest -f Dockerfile .
|
|
docker push $REGISTRY/nutriapp:$IMAGE_TAG
|
|
docker push $REGISTRY/nutriapp:latest
|
|
|
|
- name: Deploy to k3s
|
|
run: |
|
|
kubectl apply -f k8s/deployment.yml -n nutriapp
|
|
kubectl rollout status deployment/nutriapp -n nutriapp --timeout=120s
|
|
kubectl get pods -n nutriapp
|