From 7f8d72728617449e122e83c768e9d13a7486c665 Mon Sep 17 00:00:00 2001 From: Rodrigo Verdiani Date: Tue, 28 Oct 2025 21:10:34 -0300 Subject: [PATCH] feature/pipeline: add ci/cd pipeline Co-authored-by: Rodrigo Verdiani Co-committed-by: Rodrigo Verdiani --- .gitignore | 251 ++++++++++++++++++++++++++++++++++++++ .woodpecker/pipeline.yaml | 54 ++++++++ docker-compose.yml | 7 ++ 3 files changed, 312 insertions(+) create mode 100644 .gitignore create mode 100644 .woodpecker/pipeline.yaml create mode 100644 docker-compose.yml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4ffa141 --- /dev/null +++ b/.gitignore @@ -0,0 +1,251 @@ +# Created by https://www.toptal.com/developers/gitignore/api/linux,intellij,jetbrains,java,react +# Edit at https://www.toptal.com/developers/gitignore?templates=linux,intellij,jetbrains,java,react + +### Intellij ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +__pycache__ + +# User-specific stuff +.idea/** +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# AWS User-specific +.idea/**/aws.xml + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# SonarLint plugin +.idea/sonarlint/ + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +### Intellij Patch ### +# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 + +# *.iml +# modules.xml +# .idea/misc.xml +# *.ipr + +# Sonarlint plugin +# https://plugins.jetbrains.com/plugin/7973-sonarlint +.idea/**/sonarlint/ + +# SonarQube Plugin +# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin +.idea/**/sonarIssues.xml + +# Markdown Navigator plugin +# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced +.idea/**/markdown-navigator.xml +.idea/**/markdown-navigator-enh.xml +.idea/**/markdown-navigator/ + +# Cache file creation bug +# See https://youtrack.jetbrains.com/issue/JBR-2257 +.idea/$CACHE_FILE$ + +# CodeStream plugin +# https://plugins.jetbrains.com/plugin/12206-codestream +.idea/codestream.xml + +# Azure Toolkit for IntelliJ plugin +# https://plugins.jetbrains.com/plugin/8053-azure-toolkit-for-intellij +.idea/**/azureSettings.xml + +### Java ### +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* +replay_pid* + +### JetBrains ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff + +# AWS User-specific + +# Generated files + +# Sensitive or high-churn files + +# Gradle + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake + +# Mongo Explorer plugin + +# File-based project format + +# IntelliJ + +# mpeltonen/sbt-idea plugin + +# JIRA plugin + +# Cursive Clojure plugin + +# SonarLint plugin + +# Crashlytics plugin (for Android Studio and IntelliJ) + +# Editor-based Rest Client + +# Android studio 3.1+ serialized cache file + +### JetBrains Patch ### +# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 + +# *.iml +# modules.xml +# .idea/misc.xml +# *.ipr + +# Sonarlint plugin +# https://plugins.jetbrains.com/plugin/7973-sonarlint + +# SonarQube Plugin +# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin + +# Markdown Navigator plugin +# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced + +# Cache file creation bug +# See https://youtrack.jetbrains.com/issue/JBR-2257 + +# CodeStream plugin +# https://plugins.jetbrains.com/plugin/12206-codestream + +# Azure Toolkit for IntelliJ plugin +# https://plugins.jetbrains.com/plugin/8053-azure-toolkit-for-intellij + +### Linux ### +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +### react ### +.DS_* +logs +**/*.backup.* +**/*.back.* + +node_modules +bower_components + +*.sublime* + +psd +thumb +sketch + +# End of https://www.toptal.com/developers/gitignore/api/linux,intellij,jetbrains,java,react diff --git a/.woodpecker/pipeline.yaml b/.woodpecker/pipeline.yaml new file mode 100644 index 0000000..a2d41f3 --- /dev/null +++ b/.woodpecker/pipeline.yaml @@ -0,0 +1,54 @@ +# .woodpecker.yml +# ----------------- +# Build, publish, and deploy Python app + +when: + event: [ push ] + branch: [ main ] + +steps: + - name: publish-image + image: woodpeckerci/plugin-docker-buildx + settings: + platforms: linux/amd64 + repo: git.badger-pirarucu.ts.net/mangamochi/manga-matcher + registry: git.badger-pirarucu.ts.net + username: + from_secret: DOCKER_USER + password: + from_secret: DOCKER_PASSWORD + tags: + - latest + - ${CI_COMMIT_SHA} + when: + event: [ push ] + branch: [ main ] + + - name: deploy + depends_on: [ publish-image ] + image: alpine:3.20 + environment: + DEPLOY_USER: rov + DEPLOY_HOST: mangamochi.badger-pirarucu.ts.net + DEPLOY_PORT: 22 + IMAGE: git.badger-pirarucu.ts.net/mangamochi/manga-matcher:${CI_COMMIT_SHA} + DEPLOY_SSH_KEY: + from_secret: DEPLOY_SSH_KEY + commands: + - echo "🚀 Deploying to $DEPLOY_HOST ..." + - apk add --no-cache openssh-client docker-cli + - mkdir -p ~/.ssh + - echo "$DEPLOY_SSH_KEY" > ~/.ssh/id_rsa + - chmod 600 ~/.ssh/id_rsa + - ssh-keyscan -p $DEPLOY_PORT $DEPLOY_HOST >> ~/.ssh/known_hosts + - > + ssh -p $DEPLOY_PORT $DEPLOY_USER@$DEPLOY_HOST " + docker pull $IMAGE && + docker stop manga-matcher 2>/dev/null || true && + docker rm manga-matcher 2>/dev/null || true && + docker run -d --name manga-matcher --restart always -p 8000:8000 $IMAGE + " + when: + event: [ push ] + branch: [ main ] + diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..e433314 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,7 @@ +services: + manga-matcher: + build: + context: . + dockerfile: Dockerfile + ports: + - "3000:3000" \ No newline at end of file