From bc013476352b8078de09fb27e9cda7a787239651 Mon Sep 17 00:00:00 2001 From: mifi Date: Fri, 6 Feb 2026 16:17:18 -0300 Subject: [PATCH] Updates to build and pipelines --- .dockerignore | 18 +++++++ .woodpecker.yml => .woodpecker/ci.yml | 1 + .woodpecker/deploy.yml | 73 +++++++++++++++++++++++++++ AGENTS.md | 6 ++- Dockerfile | 33 ++++++++++++ README.md | 18 ++++++- docker-compose.yml | 23 +++++++-- nginx/default.conf | 20 ++++++++ package.json | 7 ++- 9 files changed, 191 insertions(+), 8 deletions(-) create mode 100644 .dockerignore rename .woodpecker.yml => .woodpecker/ci.yml (86%) create mode 100644 .woodpecker/deploy.yml create mode 100644 Dockerfile create mode 100644 nginx/default.conf diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..7eea4b9 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,18 @@ +node_modules +build +.git +.gitignore +*.md +.cursor +.devcontainer +.eslintrc.cjs +.prettierrc +.prettierignore +.eslintignore +e2e +playwright.config.ts +vitest.config.ts +test.txt +docs +.woodpecker.yml +.woodpecker diff --git a/.woodpecker.yml b/.woodpecker/ci.yml similarity index 86% rename from .woodpecker.yml rename to .woodpecker/ci.yml index b485f3a..3645ef1 100644 --- a/.woodpecker.yml +++ b/.woodpecker/ci.yml @@ -1,3 +1,4 @@ +# CI: runs on every push. Lint, check, test, build (dev), e2e. steps: build: image: node:22-bookworm-slim diff --git a/.woodpecker/deploy.yml b/.woodpecker/deploy.yml new file mode 100644 index 0000000..0500949 --- /dev/null +++ b/.woodpecker/deploy.yml @@ -0,0 +1,73 @@ +# Deploy: build image, push to registry, trigger Portainer stack redeploy. +# Runs on push/tag/manual to main only, after ci workflow succeeds. +when: + branch: main + event: [push, tag, manual] +depends_on: + - ci +steps: + - name: Docker image build + image: docker:latest + environment: + REGISTRY_REPO: git.mifi.dev/mifi-holdings/mifi-links + volumes: + - /var/run/docker.sock:/var/run/docker.sock + commands: + - set -e + - echo "=== Building Docker image ===" + - 'echo "Commit SHA: ${CI_COMMIT_SHA:0:8}"' + - 'echo "Registry repo: $REGISTRY_REPO"' + - | + docker build \ + --tag $REGISTRY_REPO:${CI_COMMIT_SHA} \ + --tag $REGISTRY_REPO:latest \ + --label "git.commit=${CI_COMMIT_SHA}" \ + --label "git.branch=${CI_COMMIT_BRANCH}" \ + . + - echo "✓ Docker image built successfully" + + - name: Push to registry + image: docker:latest + environment: + REGISTRY_URL: git.mifi.dev + REGISTRY_REPO: git.mifi.dev/mifi-holdings/mifi-links + REGISTRY_USERNAME: + from_secret: gitea_registry_username + REGISTRY_PASSWORD: + from_secret: gitea_package_token + volumes: + - /var/run/docker.sock:/var/run/docker.sock + commands: + - set -e + - echo "=== Pushing to registry ===" + - 'echo "Registry: $REGISTRY_URL"' + - 'echo "Repository: $REGISTRY_REPO"' + - | + echo "$REGISTRY_PASSWORD" | docker login "$REGISTRY_URL" \ + -u "$REGISTRY_USERNAME" \ + --password-stdin + - docker push $REGISTRY_REPO:${CI_COMMIT_SHA} + - docker push $REGISTRY_REPO:latest + - echo "✓ Images pushed successfully" + depends_on: + - Docker image build + + - name: Trigger Portainer stack redeploy + image: curlimages/curl:latest + environment: + PORTAINER_WEBHOOK_URL: + from_secret: portainer_webhook_url + commands: + - set -e + - echo "=== Triggering Portainer stack redeploy ===" + - | + resp=$(curl -s -w "\n%{http_code}" -X POST "$PORTAINER_WEBHOOK_URL") + body=$(echo "$resp" | head -n -1) + code=$(echo "$resp" | tail -n 1) + if [ "$code" != "200" ] && [ "$code" != "204" ]; then + echo "Webhook failed (HTTP $code): $body" + exit 1 + fi + echo "✓ Portainer redeploy triggered (HTTP $code)" + depends_on: + - Push to registry diff --git a/AGENTS.md b/AGENTS.md index cd1e647..32ffa41 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -19,7 +19,7 @@ This repo is a **one-page static** Linktree-style site for mifi.dev. It is **not - Use **semantic HTML** and **JSON-LD** for SEO; target **WCAG 2.2 AAA** for accessibility. - **No unsafe-inline** scripts; all JS via `