73 lines
2.5 KiB
YAML
73 lines
2.5 KiB
YAML
# ─── BETE GitLab CI Pipeline ───────────────────────────────────────────────────
|
|
# Builds 3 Docker images (backend, discord-gateway, proxy) and pushes to
|
|
# GitLab Container Registry with both `:$CI_COMMIT_SHA` and `:latest` tags.
|
|
#
|
|
# Deploy manually from your dev machine:
|
|
# export VPS_HOST=... VPS_USER=... VPS_SSH_KEY=... GITLAB_TOKEN=...
|
|
# ./deploy.sh # build + deploy all
|
|
# ./deploy.sh --backend # backend only
|
|
# ./deploy.sh --frontend # frontend only
|
|
# ./deploy.sh --no-build # skip build, just copy files
|
|
#
|
|
# ──────────────────────────────────────────────────────────────────────────────
|
|
|
|
stages:
|
|
- build
|
|
|
|
variables:
|
|
# Submodules — discord.js-selfbot-v13 and discord-video-stream
|
|
GIT_SUBMODULE_STRATEGY: recursive
|
|
|
|
REGISTRY: $CI_REGISTRY
|
|
REGISTRY_PROJECT: $CI_REGISTRY/$CI_PROJECT_PATH
|
|
IMAGE_TAG_COMMIT: $CI_COMMIT_SHA
|
|
IMAGE_TAG_LATEST: latest
|
|
|
|
# Deploy target
|
|
SSH_HOST: "${VPS_USERNAME}@${VPS_HOST}"
|
|
APP_DIR: /opt/imphenbot
|
|
|
|
# ── Build stage ───────────────────────────────────────────────────────────────
|
|
.docker-build:
|
|
stage: build
|
|
image: docker:27-cli
|
|
services:
|
|
- name: docker:27-dind
|
|
command: ["--mtu=1400"]
|
|
before_script:
|
|
- echo "$CI_JOB_TOKEN" | docker login "$CI_REGISTRY" -u "$CI_REGISTRY_USER" --password-stdin
|
|
script:
|
|
# Build image
|
|
- |
|
|
docker build \
|
|
--file infra/docker/Dockerfile.$SERVICE_NAME \
|
|
--tag $REGISTRY_PROJECT/bete-$SERVICE_NAME:$IMAGE_TAG_COMMIT \
|
|
--tag $REGISTRY_PROJECT/bete-$SERVICE_NAME:$IMAGE_TAG_LATEST \
|
|
--build-arg BUILDKIT_INLINE_CACHE=1 \
|
|
--cache-from $REGISTRY_PROJECT/bete-$SERVICE_NAME:latest \
|
|
.
|
|
# Push to GitLab Container Registry
|
|
- docker push $REGISTRY_PROJECT/bete-$SERVICE_NAME:$IMAGE_TAG_COMMIT
|
|
- docker push $REGISTRY_PROJECT/bete-$SERVICE_NAME:$IMAGE_TAG_LATEST
|
|
|
|
build-backend:
|
|
extends: .docker-build
|
|
variables:
|
|
SERVICE_NAME: backend
|
|
only:
|
|
- master
|
|
|
|
build-discord-gateway:
|
|
extends: .docker-build
|
|
variables:
|
|
SERVICE_NAME: discord-gateway
|
|
only:
|
|
- master
|
|
|
|
build-proxy:
|
|
extends: .docker-build
|
|
variables:
|
|
SERVICE_NAME: proxy
|
|
only:
|
|
- master
|