Compare commits

..

5 Commits

Author SHA1 Message Date
f2c6388da6 Fix env variable
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 50s
2025-05-30 15:35:57 +02:00
66c5891510 Remove fix
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 33s
2025-05-30 11:33:06 +02:00
eb6c40c2f5 Fix workflow
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 29s
2025-05-30 11:07:50 +02:00
19119e5c77 Fix workflow & add makefile
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 49s
2025-05-30 11:06:00 +02:00
1e3f62d3c4 Add workflow & helm
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 31s
2025-05-30 09:38:11 +02:00
7 changed files with 6643 additions and 6480 deletions

View File

@@ -0,0 +1,76 @@
name: Build and Push Docker Image
on:
push:
branches:
- master
tags:
- 'build_*'
pull_request:
branches:
- master
env:
REGISTRY: rgy.angels-dev.fr
IMAGE_PATH: prod
IMAGE_NAME: bot_tamiseur
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_PATH }}/${{ env.IMAGE_NAME }}
tags: |
# Tag avec le nom de la branche
type=ref,event=branch
# Tag avec le nom du tag Git
type=ref,event=tag
# Tag avec le SHA du commit
type=sha,prefix={{branch}}-
# Tag latest pour la branche master
type=raw,value=latest,enable={{is_default_branch}}
labels: |
org.opencontainers.image.title=${{ env.IMAGE_NAME }}
org.opencontainers.image.description=Bot Discord
org.opencontainers.image.url=https://gitea.zac.ovh/zachary/bot_Tamiseur
org.opencontainers.image.source=https://gitea.zac.ovh/zachary/bot_Tamiseur
org.opencontainers.image.revision=${{ github.sha }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_PATH }}/${{ env.IMAGE_NAME }}
subject-digest: ${{ steps.build.outputs.digest }}
push-to-registry: true

22
Makefile Normal file
View File

@@ -0,0 +1,22 @@
# =====================
# Build new application
# =====================
.PHONY: tag-build
tag-build: ## DEV : Build a prod version with a timestamped tag
@export TIMESTAMP=build_`date +"%G-%m-%d_%Hh%M"`; \
echo TAG = $$TIMESTAMP; \
git tag $$TIMESTAMP; \
git push origin $$TIMESTAMP;
# ===============
# Deployment tags
# ===============
.PHONY: tag-deploy
tag-deploy: ## DEV : Set tag to current HEAD to deploy in production
@export TIMESTAMP=deploy_`date +"%G-%m-%d_%Hh%M"`; \
echo TAG = $$TIMESTAMP; \
git tag $$TIMESTAMP; \
git push origin $$TIMESTAMP;

12
deploy/Chart.yaml Normal file
View File

@@ -0,0 +1,12 @@
# Version schéma helm (v2 = helm3)
apiVersion: v2
# Nom de l'application déployée
name: bot_tamiseur
# Version du chart : doit changer si l'application change ou si la configuration du chart change
#version: 1
version: "1"
# icon (optionnel) mais génère un warning avec "helm lint"
icon: https://helm.sh/img/helm-logo.svg

View File

@@ -0,0 +1,34 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}
spec:
replicas: 1
revisionHistoryLimit: 0
strategy:
type: {{ .Values.deployment.strategy }}
selector:
matchLabels:
pod: {{ .Release.Name }}
template:
metadata:
labels:
pod: {{ .Release.Name }}
spec:
securityContext:
runAsUser: 1000
runAsGroup: 1000
fsGroup: 1000
containers:
- name: {{ .Release.Name }}
image: "{{ .Values.deployment.image.repository }}:{{ .Values.deployment.image.tag }}"
imagePullPolicy: {{ .Values.deployment.image.pullPolicy }}
env:
{{ range $envName, $envValue := .Values.deployment.env }}
- name: {{ $envName | quote}}
value: {{ $envValue | quote}}
{{ end }}
{{- if .Values.deployment.resources.enable }}
resources:
{{- toYaml .Values.deployment.resources | nindent 12 }}
{{- end }}

18
deploy/values.yaml Normal file
View File

@@ -0,0 +1,18 @@
deployment:
replica: 1
strategy: RollingUpdate
image:
repository: "rgy.angels-dev.fr/prod/bot_tamiseur"
tag: "3.0.4"
pullPolicy: IfNotPresent
env:
NODE_ENV: "production"
## Pas de limite CPU pour éviter latence
resources:
limits:
# cpu: ""
# Memory: "500Mi"
requests:
Cpu: "0.1"
Memory: "50Mi"

12959
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -33,7 +33,7 @@
"jsdom": "^25.0.1",
"libsodium-wrappers": "^0.7.15",
"mediaplex": "^1.0.0",
"mongoose": "^8.9.5",
"mongoose": "^8.9.3",
"parse-torrent": "^9.1.5",
"require-all": "^3.0.0",
"rss-parser": "^3.13.0",