- Remove container spec and DinD service - Try to access host Docker daemon via various endpoints - Test unix:///var/run/docker.sock, TCP localhost, Docker bridge - This bypasses network isolation issues - If this works, we can use Buildx in next step
139 lines
4.3 KiB
YAML
139 lines
4.3 KiB
YAML
name: Lint, Build, and Docker
|
|
|
|
on:
|
|
push:
|
|
branches: [main, develop]
|
|
pull_request:
|
|
branches: [main, develop]
|
|
|
|
jobs:
|
|
# ==============================================================================
|
|
# Job 1: Format Check
|
|
# ==============================================================================
|
|
format:
|
|
runs-on: docker
|
|
container:
|
|
image: rust:latest
|
|
|
|
steps:
|
|
- name: Install Node.js for checkout
|
|
run: |
|
|
apt-get update
|
|
apt-get install -y curl gnupg
|
|
curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
|
|
apt-get install -y nodejs
|
|
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
apt-get update
|
|
apt-get install -y pkg-config libssl-dev
|
|
rustup component add rustfmt
|
|
|
|
- name: Check formatting
|
|
working-directory: ./backend
|
|
run: cargo fmt --all -- --check
|
|
|
|
# ==============================================================================
|
|
# Job 2: Lint
|
|
# ==============================================================================
|
|
clippy:
|
|
runs-on: docker
|
|
container:
|
|
image: rust:latest
|
|
|
|
steps:
|
|
- name: Install Node.js for checkout
|
|
run: |
|
|
apt-get update
|
|
apt-get install -y curl gnupg
|
|
curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
|
|
apt-get install -y nodejs
|
|
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
apt-get update
|
|
apt-get install -y pkg-config libssl-dev
|
|
rustup component add clippy
|
|
|
|
- name: Run Clippy
|
|
working-directory: ./backend
|
|
run: cargo clippy --all-targets --all-features
|
|
|
|
# ==============================================================================
|
|
# Job 3: Build - Depends on format and clippy
|
|
# ==============================================================================
|
|
build:
|
|
runs-on: docker
|
|
container:
|
|
image: rust:latest
|
|
needs: [format, clippy]
|
|
|
|
steps:
|
|
- name: Install Node.js for checkout
|
|
run: |
|
|
apt-get update
|
|
apt-get install -y curl gnupg
|
|
curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
|
|
apt-get install -y nodejs
|
|
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
apt-get update
|
|
apt-get install -y pkg-config libssl-dev
|
|
|
|
- name: Build release binary
|
|
working-directory: ./backend
|
|
run: cargo build --release --verbose
|
|
|
|
# ==============================================================================
|
|
# Job 4: Docker Build - Try accessing host Docker via DOCKER_HOST
|
|
# ==============================================================================
|
|
docker-build:
|
|
runs-on: docker
|
|
needs: [build]
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Try accessing Docker
|
|
run: |
|
|
echo "Checking Docker availability..."
|
|
# Try various Docker host options
|
|
if docker info >/dev/null 2>&1; then
|
|
echo "✅ Docker accessible via default socket"
|
|
elif docker -H unix:///var/run/docker.sock info >/dev/null 2>&1; then
|
|
echo "✅ Docker accessible via /var/run/docker.sock"
|
|
export DOCKER_HOST=unix:///var/run/docker.sock
|
|
elif docker -H tcp://127.0.0.1:2375 info >/dev/null 2>&1; then
|
|
echo "✅ Docker accessible via TCP localhost"
|
|
export DOCKER_HOST=tcp://127.0.0.1:2375
|
|
elif docker -H tcp://172.17.0.1:2375 info >/dev/null 2>&1; then
|
|
echo "✅ Docker accessible via Docker bridge"
|
|
export DOCKER_HOST=tcp://172.17.0.1:2375
|
|
else
|
|
echo "❌ Docker not accessible"
|
|
echo "Available network interfaces:"
|
|
ip addr show
|
|
exit 1
|
|
fi
|
|
|
|
- name: Show Docker version
|
|
run: docker version
|
|
|
|
- name: Build Docker image
|
|
working-directory: ./backend
|
|
run: |
|
|
docker build -f docker/Dockerfile -t normogen-backend:${{ github.sha }} -t normogen-backend:latest .
|
|
|
|
- name: Show images
|
|
run: docker images normogen-backend
|