continuous-integration/drone/push Build is failing
Same fix as iled-shop for reliable Pi deploys. Co-authored-by: Cursor <cursoragent@cursor.com>
151 lines
3.2 KiB
YAML
151 lines
3.2 KiB
YAML
kind: pipeline
|
|
type: docker
|
|
name: build-and-push
|
|
|
|
platform:
|
|
os: linux
|
|
arch: amd64
|
|
|
|
dns:
|
|
- 192.168.0.64
|
|
|
|
concurrency:
|
|
limit: 1
|
|
|
|
clone:
|
|
depth: 50
|
|
|
|
steps:
|
|
- name: test
|
|
image: oven/bun:1-alpine
|
|
pull: false
|
|
environment:
|
|
BUN_INSTALL_CACHE_DIR: /drone-cache/bun
|
|
commands:
|
|
- bun install --frozen-lockfile
|
|
- bun run test
|
|
|
|
- name: build
|
|
image: oven/bun:1-alpine
|
|
pull: false
|
|
environment:
|
|
BUN_INSTALL_CACHE_DIR: /drone-cache/bun
|
|
STRAVA_CLIENT_ID:
|
|
from_secret: strava_client_id
|
|
STRAVA_REDIRECT_URI:
|
|
from_secret: strava_redirect_uri
|
|
RIOT_REGION:
|
|
from_secret: riot_region
|
|
RIOT_SUMMONER_NAME_LOL:
|
|
from_secret: riot_summoner_name_lol
|
|
RIOT_SUMMONER_NAME_TFT:
|
|
from_secret: riot_summoner_name_tft
|
|
RIOT_TAG_LINE:
|
|
from_secret: riot_tag_line
|
|
FACEIT_USER_ID:
|
|
from_secret: faceit_user_id
|
|
ROCKET_LEAGUE_PLATFORM:
|
|
from_secret: rocket_league_platform
|
|
ROCKET_LEAGUE_USERNAME:
|
|
from_secret: rocket_league_username
|
|
commands:
|
|
- bun run build:ssr
|
|
depends_on:
|
|
- test
|
|
|
|
- name: docker
|
|
image: plugins/docker
|
|
pull: false
|
|
settings:
|
|
repo: registry.zea.lt/miczek/tracker
|
|
registry: registry.zea.lt
|
|
platform: linux/arm64
|
|
username:
|
|
from_secret: registry_username
|
|
password:
|
|
from_secret: registry_password
|
|
build_args_from_env: true
|
|
cache_from:
|
|
- registry.zea.lt/miczek/tracker:latest
|
|
tags:
|
|
- latest
|
|
- ${DRONE_COMMIT_SHA:0:7}
|
|
when:
|
|
branch:
|
|
- main
|
|
- master
|
|
depends_on:
|
|
- build
|
|
|
|
trigger:
|
|
event:
|
|
- push
|
|
- pull_request
|
|
- custom
|
|
|
|
---
|
|
kind: pipeline
|
|
type: docker
|
|
name: deploy
|
|
|
|
platform:
|
|
os: linux
|
|
arch: amd64
|
|
|
|
dns:
|
|
- 192.168.0.64
|
|
|
|
depends_on:
|
|
- build-and-push
|
|
|
|
clone:
|
|
disable: true
|
|
|
|
concurrency:
|
|
limit: 1
|
|
|
|
steps:
|
|
- name: ssh-deploy
|
|
image: alpine:3.20
|
|
pull: false
|
|
environment:
|
|
SSH_HOST:
|
|
from_secret: ssh_host
|
|
SSH_USER:
|
|
from_secret: ssh_user
|
|
SSH_KEY:
|
|
from_secret: ssh_key
|
|
SSH_PORT:
|
|
from_secret: ssh_port
|
|
REGISTRY_USERNAME:
|
|
from_secret: registry_username
|
|
REGISTRY_PASSWORD:
|
|
from_secret: registry_password
|
|
commands:
|
|
- apk add --no-cache openssh-client
|
|
- mkdir -p /root/.ssh && chmod 700 /root/.ssh
|
|
- printenv SSH_KEY > /root/.ssh/id_ed25519 && chmod 600 /root/.ssh/id_ed25519
|
|
- |
|
|
ssh -i /root/.ssh/id_ed25519 \
|
|
-p "${SSH_PORT:-22}" \
|
|
-o StrictHostKeyChecking=accept-new \
|
|
-o BatchMode=yes \
|
|
"${SSH_USER}@${SSH_HOST}" \
|
|
"export REGISTRY_USERNAME='${REGISTRY_USERNAME}' REGISTRY_PASSWORD='${REGISTRY_PASSWORD}'; bash -s" <<'EOS'
|
|
set -euo pipefail
|
|
echo "${REGISTRY_PASSWORD}" | docker login registry.zea.lt -u "${REGISTRY_USERNAME}" --password-stdin
|
|
cd /home/miczek/homelab/tracker
|
|
docker compose pull
|
|
docker compose up -d --remove-orphans
|
|
docker compose ps
|
|
docker logout registry.zea.lt || true
|
|
EOS
|
|
|
|
trigger:
|
|
branch:
|
|
- master
|
|
- main
|
|
event:
|
|
- push
|
|
- custom
|