Skip to content

(fixing matrix scripts) #2

(fixing matrix scripts)

(fixing matrix scripts) #2

name: Build Docker Images on Multiple OS
on:
push:
branches:
- '**'
#workflow_run:
# workflows: ["Check Version Difference"]
# types:
# - completed
jobs:
build-docker:
# Remove the below line to run the workflow with Act
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Docker for Linux
if: matrix.os == 'ubuntu-latest'
run: |
cp .env.example .env
sed -i "s/'jsonrpc'/'localhost'/g" .env
sudo apt-get update
sudo apt-get install -y docker.io
sudo systemctl start docker
sudo systemctl enable docker
sudo usermod -aG docker $USER
shell: bash
- name: Set up Docker - Windows
if: matrix.os == 'windows-latest'
run: |
copy .env.example .env
powershell -Command "(Get-Content .env) -replace \"'jsonrpc'\", \"'localhost'\" | Set-Content .env"
choco install docker-cli
Start-Service com.docker.service
shell: powershell
- name: Set up Docker for macOS
if: matrix.os == 'macos-latest'
run: |
cp .env.example .env
sed -i '' "s/'jsonrpc'/'localhost'/g" .env
brew install --cask docker
open /Applications/Docker.app & # Start Docker in background
# Wait for Docker to start
timeout=300 # Timeout after 300 seconds (5 minutes)
until docker info >/dev/null 2>&1 || [ $timeout -eq 0 ]; do
echo "Waiting for Docker to start..."
sleep 5
((timeout-=5))
done
if [ $timeout -eq 0 ]; then
echo "Timed out waiting for Docker to start"
exit 1
else
echo "Docker is up and running!"
fi
shell: bash
- name: Build Docker images
run: |
for DOCKERFILE in docker/*; do
docker build -f $DOCKERFILE -t os-builds-$DOCKERFILE .
done