fixes
Some checks failed
continuous-integration/drone Build is failing

This commit is contained in:
2025-11-29 18:59:02 +05:30
parent 62c1f3920b
commit 8ff199ca10
2 changed files with 8 additions and 76 deletions

View File

@@ -16,48 +16,6 @@ volumes:
path: /var/run/docker.sock
steps:
# -----------------------------------------------------
# 1. Fetch latest Git tag
# -----------------------------------------------------
- name: fetch-tags
image: docker:24
volumes:
- name: dockersock
path: /var/run/docker.sock
commands:
- apk add --no-cache git
- git fetch --tags
- |
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null | tr -d '\n')
echo "Latest Git tag: $LATEST_TAG"
echo "$LATEST_TAG" > /drone/src/LATEST_TAG.txt
if [ -z "$LATEST_TAG" ]; then
echo "❌ No git tags found. Cannot continue."
exit 1
fi
# -----------------------------------------------------
# 2. Check if remote image already exists
# -----------------------------------------------------
- name: check-remote-image
image: docker:24
volumes:
- name: dockersock
path: /var/run/docker.sock
environment:
REGISTRY_HOST:
from_secret: REGISTRY_HOST
commands:
- IMAGE_TAG=$(cat /drone/src/LATEST_TAG.txt | tr -d '\n')
- echo "Checking if $REGISTRY_HOST/lila-games/nakama-server:$IMAGE_TAG exists..."
- |
if docker pull $REGISTRY_HOST/lila-games/nakama-server:$IMAGE_TAG > /dev/null 2>&1; then
echo "✅ Image already exists: $REGISTRY_HOST/lila-games/nakama-server:$IMAGE_TAG"
exit 78
else
echo "⚙️ Image does not exist. Will build."
fi
# -----------------------------------------------------
# 3. Build Nakama Docker image
# -----------------------------------------------------
@@ -68,40 +26,13 @@ steps:
path: /var/run/docker.sock
commands:
- IMAGE_TAG=$(cat /drone/src/LATEST_TAG.txt | tr -d '\n')
- echo "🔨 Building Nakama image lila-games/nakama-server:$IMAGE_TAG"
- echo "🔨 Building Nakama image lila-games/nakama-server:latest"
- |
docker build \
--network=host \
-t lila-games/nakama-server:$IMAGE_TAG \
-t lila-games/nakama-server:latest \
/drone/src
# -----------------------------------------------------
# 4. Push Nakama image to registry
# -----------------------------------------------------
- name: push-image
image: docker:24
volumes:
- name: dockersock
path: /var/run/docker.sock
environment:
REGISTRY_HOST:
from_secret: REGISTRY_HOST
REGISTRY_USER:
from_secret: REGISTRY_USER
REGISTRY_PASS:
from_secret: REGISTRY_PASS
commands:
- IMAGE_TAG=$(cat /drone/src/LATEST_TAG.txt | tr -d '\n')
- echo "🔑 Logging into registry..."
- echo "$REGISTRY_PASS" | docker login $REGISTRY_HOST -u "$REGISTRY_USER" --password-stdin
- echo "🏷️ Tagging images..."
- docker tag lila-games/nakama-server:$IMAGE_TAG $REGISTRY_HOST/lila-games/nakama-server:$IMAGE_TAG
- docker tag lila-games/nakama-server:$IMAGE_TAG $REGISTRY_HOST/lila-games/nakama-server:latest
- echo "📤 Pushing images..."
- docker push $REGISTRY_HOST/lila-games/nakama-server:$IMAGE_TAG
- docker push $REGISTRY_HOST/lila-games/nakama-server:latest
# -----------------------------------------------------
# 5. Stop old Nakama container
# -----------------------------------------------------
@@ -151,4 +82,4 @@ steps:
# -----------------------------------------------------
trigger:
event:
- tag
- custom

View File

@@ -3,19 +3,20 @@
# -----------------------------------------------------
FROM golang:1.22-alpine AS plugin_builder
# Install dependencies needed for CGO plugin build
RUN apk add --no-cache git build-base binutils musl-dev
# Install full toolchain for CGO + plugins
RUN apk add --no-cache \
git \
build-base \
binutils \
musl-dev
WORKDIR /workspace
# Download module deps first (better caching)
COPY go.mod go.sum ./
RUN go mod download
# Copy source code
COPY . .
# Build plugin
RUN mkdir -p build && \
CGO_ENABLED=1 go build \
--trimpath \