### GitHub Actions: Install Docker Compose v2 Source: https://context7.com/open-condo-software/actions-setup-docker-compose/llms.txt Configures the GitHub Action workflow to install a specific version of Docker Compose (v2.x). It checks out code, sets up Docker Compose, and then runs commands to verify the installation and start services. ```yaml name: CI Pipeline on: [push, pull_request] jobs: build: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 - name: Setup Docker Compose uses: open-condo-software/actions-setup-docker-compose@v1 with: version: 'v2.28.1' - name: Verify installation run: docker-compose version - name: Start services run: docker-compose up -d ``` -------------------------------- ### Bootstrap Docker Compose Installation and Setup Source: https://context7.com/open-condo-software/actions-setup-docker-compose/llms.txt Handles the main execution flow for setting up Docker Compose. It retrieves the version input, validates it, calls the installation function, adds the binary to the PATH, and sets an output variable. Includes error handling and reporting using '@actions/core'. ```typescript import { run } from './main' import * as core from '@actions/core' async function bootstrap(): Promise { try { // Get and validate version input const version = core.getInput('version', { trimWhitespace: true }) if (!version.startsWith('v')) { throw new Error('Version must start with "v" (e.g., v2.28.1)') } // Install and configure const path = await run(version) core.info(`Docker Compose installed at: ${path}`) core.addPath(path) // Set output for downstream steps core.setOutput('docker-compose-path', path) } catch (error) { const message = error instanceof Error ? error.message : 'Unknown error' core.setFailed(`Setup failed: ${message}`) process.exit(1) } } ``` -------------------------------- ### GitHub Actions: Workflow with Service Containers and Docker Compose Source: https://context7.com/open-condo-software/actions-setup-docker-compose/llms.txt Integrates Docker Compose setup with service containers (e.g., PostgreSQL) for integration testing. The workflow checks out code, sets up Docker Compose, starts the application stack using a compose file, runs tests, and cleans up afterwards. ```yaml name: Integration Tests on: [push] jobs: test: runs-on: ubuntu-latest services: postgres: image: postgres:15 env: POSTGRES_PASSWORD: test ports: - 5432:5432 steps: - uses: actions/checkout@v4 - name: Setup Docker Compose uses: open-condo-software/actions-setup-docker-compose@v1 with: version: 'v2.28.1' - name: Start application stack run: | docker-compose -f docker-compose.test.yml up -d docker-compose ps - name: Run tests run: npm test - name: Cleanup if: always() run: docker-compose down -v ``` -------------------------------- ### TypeScript: Programmatic Docker Compose Installation Source: https://context7.com/open-condo-software/actions-setup-docker-compose/llms.txt Provides a programmatic way to install a specific version of Docker Compose using TypeScript. This function handles downloading, caching, adding to PATH, and verifying the installation. ```typescript import { run } from './main' import * as core from '@actions/core' async function setupDockerCompose(): Promise { try { // Install specific version const cachePath = await run('v2.27.1') // Add to system PATH core.addPath(cachePath) core.info(`Docker Compose installed at: ${cachePath}`) // Verify installation const { exec } = require('@actions/exec') await exec('docker-compose', ['version']) } catch (error) { core.setFailed(`Installation failed: ${error.message}`) } } ``` -------------------------------- ### GitHub Actions: Install Docker Compose (Default Version) Source: https://context7.com/open-condo-software/actions-setup-docker-compose/llms.txt Sets up Docker Compose using its default version when no specific version parameter is provided in the workflow. It then runs commands to verify the installation and manage Docker Compose services. ```yaml steps: - name: Setup Docker Compose (default version) uses: open-condo-software/actions-setup-docker-compose@v1 - name: Run containers run: | docker-compose version docker-compose -f docker-compose.yml up -d docker-compose ps ``` -------------------------------- ### Download and Cache Docker Compose Binary Source: https://context7.com/open-condo-software/actions-setup-docker-compose/llms.txt Downloads a specific version of Docker Compose for the detected system architecture and caches it using GitHub Actions tool-cache. It makes the binary executable and returns its cached path. Dependencies include '@actions/tool-cache' and '@actions/exec'. ```typescript import { downloadTool, cacheFile } from '@actions/tool-cache' import { exec } from '@actions/exec' async function installCustomVersion(): Promise { const version = 'v2.28.1' const system = 'Linux' const hardware = 'x86_64' // Construct download URL const url = `https://github.com/docker/compose/releases/download/${version}/docker-compose-${system}-${hardware}` // Download binary const downloadPath = await downloadTool(url) // Make executable await exec(`chmod +x ${downloadPath}`) // Cache for future runs const cachedPath = await cacheFile( downloadPath, 'docker-compose', 'docker-compose', 'latest' ) return cachedPath } ``` -------------------------------- ### GitHub Actions: Multi-Version Docker Compose Testing with Matrix Source: https://context7.com/open-condo-software/actions-setup-docker-compose/llms.txt Utilizes GitHub Actions matrix strategy to test against multiple Docker Compose versions. Each job in the matrix configures and verifies a specific Docker Compose version before running a compose file configuration check. ```yaml name: Compatibility Tests on: [push] jobs: test-versions: runs-on: ubuntu-latest strategy: matrix: compose-version: ['v2.20.0', 'v2.24.0', 'v2.28.1'] steps: - uses: actions/checkout@v4 - name: Setup Docker Compose ${{ matrix.compose-version }} uses: open-condo-software/actions-setup-docker-compose@v1 with: version: ${{ matrix.compose-version }} - name: Verify version run: | VERSION=$(docker-compose version --short) echo "Installed version: $VERSION" [[ "$VERSION" == *"${{ matrix.compose-version }}"* ]] - name: Test compose file run: docker-compose config --quiet ``` -------------------------------- ### TypeScript: Execute Shell Commands and Capture Output Source: https://context7.com/open-condo-software/actions-setup-docker-compose/llms.txt A utility function in TypeScript for executing shell commands and capturing their output, including error handling. It's used here to detect system information and Docker Compose version. ```typescript import { runCommand } from './main' async function detectSystemInfo(): Promise { try { // Get system information const system = await runCommand('uname -s') // Returns: "Linux" const hardware = await runCommand('uname -m') // Returns: "x86_64" const version = await runCommand('docker-compose version') console.log(`System: ${system}`) console.log(`Architecture: ${hardware}`) console.log(`Docker Compose: ${version}`) } catch (error) { console.error(`Command failed: ${error.message}`) } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.