Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,19 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -r build_requirements.txt

# Install system package tools based on platform
if [ "${{ matrix.platform }}" = "linux" ]; then
sudo apt-get update
sudo apt-get install -y dpkg-dev
elif [ "${{ matrix.platform }}" = "win" ]; then
# WiX tools would need to be installed here for Windows MSI creation
echo "WiX tools installation would go here for MSI creation"
elif [ "${{ matrix.platform }}" = "macos" ]; then
# pkgbuild is available by default on macOS
echo "pkgbuild is available by default on macOS"
fi
shell: bash

- name: Build executable
run: |
Expand Down
134 changes: 134 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
name: Build and Push Docker Images

on:
push:
branches: [ main, develop ]
tags: [ 'v*' ]
pull_request:
branches: [ main ]

env:
REGISTRY: ghcr.io
REPO: stackvista/agent-integrations-finder
IMAGE_NAME: ghcr.io/stackvista/agent-integrations-finder

jobs:
docker-build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/stackvista/agent-integrations-finder
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha
type=raw,value=latest,enable={{is_default_branch}}

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r build_requirements.txt

- name: Build and push Docker images
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Build individual architecture images
if: github.event_name != 'pull_request'
run: |
# Build amd64 image
docker buildx build \
--platform linux/amd64 \
--tag ghcr.io/stackvista/agent-integrations-finder:${{ github.sha }}-amd64 \
--push \
.

# Build arm64 image
docker buildx build \
--platform linux/arm64 \
--tag ghcr.io/stackvista/agent-integrations-finder:${{ github.sha }}-arm64 \
--push \
.

# Add version tags if this is a release (tag push)
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
VERSION_TAG="${{ github.ref_name }}"
echo "Creating version tags: $VERSION_TAG"

# Tag amd64 image with version
docker tag ghcr.io/stackvista/agent-integrations-finder:${{ github.sha }}-amd64 \
ghcr.io/stackvista/agent-integrations-finder:$VERSION_TAG-amd64
docker push ghcr.io/stackvista/agent-integrations-finder:$VERSION_TAG-amd64

# Tag arm64 image with version
docker tag ghcr.io/stackvista/agent-integrations-finder:${{ github.sha }}-arm64 \
ghcr.io/stackvista/agent-integrations-finder:$VERSION_TAG-arm64
docker push ghcr.io/stackvista/agent-integrations-finder:$VERSION_TAG-arm64
fi

- name: Create multi-architecture manifest
if: github.event_name != 'pull_request'
run: |
# Create manifest with git SHA
docker buildx imagetools create -t ghcr.io/stackvista/agent-integrations-finder:${{ github.sha }} \
ghcr.io/stackvista/agent-integrations-finder:${{ github.sha }}-amd64 \
ghcr.io/stackvista/agent-integrations-finder:${{ github.sha }}-arm64

# Create manifest with version tag if this is a release
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
VERSION_TAG="${{ github.ref_name }}"
echo "Creating version manifest: $VERSION_TAG"
docker buildx imagetools create -t ghcr.io/stackvista/agent-integrations-finder:$VERSION_TAG \
ghcr.io/stackvista/agent-integrations-finder:$VERSION_TAG-amd64 \
ghcr.io/stackvista/agent-integrations-finder:$VERSION_TAG-arm64
fi

- name: Show image info
run: |
echo "Built images:"
docker images ghcr.io/stackvista/agent-integrations-finder || true
echo ""
echo "Available tags:"
echo "- ghcr.io/stackvista/agent-integrations-finder:${{ github.sha }}"
echo "- ghcr.io/stackvista/agent-integrations-finder:${{ github.sha }}-amd64"
echo "- ghcr.io/stackvista/agent-integrations-finder:${{ github.sha }}-arm64"
if [[ "${{ github.ref_name }}" != "${{ github.sha }}" ]]; then
echo "- ghcr.io/stackvista/agent-integrations-finder:${{ github.ref_name }}"
echo "- ghcr.io/stackvista/agent-integrations-finder:${{ github.ref_name }}-amd64"
echo "- ghcr.io/stackvista/agent-integrations-finder:${{ github.ref_name }}-arm64"
fi
66 changes: 66 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Multi-stage Dockerfile for Agent Integrations Finder
# Stage 1: Build stage
FROM python:3.11-slim AS builder

# Install build dependencies
RUN apt-get update && apt-get install -y \
gcc \
g++ \
make \
zip \
tar \
gzip \
dpkg-dev \
&& rm -rf /var/lib/apt/lists/*

# Set working directory
WORKDIR /app

# Copy requirements and install Python dependencies
COPY requirements.txt build_requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt -r build_requirements.txt

# Copy source code
COPY . .

# Build the executable for the target architecture
ARG TARGETARCH
RUN if [ "$TARGETARCH" = "amd64" ]; then \
python build.py linux-x86_64; \
elif [ "$TARGETARCH" = "arm64" ]; then \
python build.py linux-aarch64; \
else \
echo "Unsupported architecture: $TARGETARCH"; \
exit 1; \
fi

# Stage 2: Runtime stage
FROM python:3.11-slim AS runtime

# Install minimal runtime dependencies
RUN apt-get update && apt-get install -y \
libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*

# Create non-root user
RUN useradd --create-home --shell /bin/bash app

# Set working directory
WORKDIR /app

# Copy Python dependencies from builder stage
COPY --from=builder /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages/

# Copy the application source
COPY --from=builder /app/integrations_finder.py /app/

# Switch to non-root user
USER app

# Set environment variables
ENV PYTHONPATH=/usr/local/lib/python3.11/site-packages
ENV PATH=/usr/local/bin:$PATH

# Default command
ENTRYPOINT ["python", "/app/integrations_finder.py"]
CMD ["--help"]
Loading
Loading