Files
homepage/.drone.yml
aetos 1a2c725f6b
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone Build is failing
Update .drone.yml
changed from private-pi to 192.168.1.111
2025-10-10 09:49:53 +00:00

76 lines
1.9 KiB
YAML

---
kind: pipeline
type: docker
name: default
# ARM64 platform (for your Pi runner)
platform:
os: linux
arch: arm64
workspace:
path: /drone/src
steps:
# Step 1: Check if image for the latest tag exists locally
- name: check-version
image: docker:24
environment:
DOCKER_HOST: unix:///var/run/docker.sock
commands:
- apk add --no-cache git
- git fetch --tags
- |
LATEST_TAG=$(git describe --tags --abbrev=0)
echo "Latest Git tag: $LATEST_TAG"
if docker image inspect apps/homepage:$LATEST_TAG > /dev/null 2>&1; then
echo "✅ Docker image apps/homepage:$LATEST_TAG already exists — skipping build"
exit 78 # tells Drone to stop pipeline gracefully
else
echo "⚙️ Docker image apps/homepage:$LATEST_TAG not found — proceeding to build..."
fi
# Step 2: Build Docker image (dynamic tag)
- name: build-image
image: docker:24
environment:
DOCKER_HOST: tcp://192.168.1.111:2376
commands:
- |
IMAGE_TAG=${DRONE_TAG:-latest}
echo "🔨 Building Docker image apps/homepage:$IMAGE_TAG ..."
docker build -t apps/homepage:$IMAGE_TAG .
# Step 3: Stop old container (if exists)
- name: stop-old
image: docker:24
environment:
DOCKER_HOST: tcp://192.168.1.111:2376
commands:
- |
echo "🛑 Stopping old container..."
docker rm -f homepage || true
# Step 4: Run container
- name: run-container
image: docker:24
environment:
DOCKER_HOST: tcp://192.168.1.111:2376
commands:
- |
IMAGE_TAG=${DRONE_TAG:-latest}
echo "🚀 Starting container apps/homepage:$IMAGE_TAG ..."
docker run -d \
--name homepage \
-p 3001:3000 \
-e NODE_ENV=production \
apps/homepage:$IMAGE_TAG
# Trigger rules
trigger:
event:
- push
- tag
- custom