Skip to content

Commit

Permalink
fix: docker image publish
Browse files Browse the repository at this point in the history
  • Loading branch information
stephancill committed Sep 16, 2024
1 parent 7d7f0b5 commit 3971412
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,48 +21,53 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

# Step 3: Set up Docker Compose
# Step 3: Create a new builder instance
- name: Create builder
run: docker buildx create --use

# Step 4: Set up Docker Compose
- name: Set up Docker Compose
run: sudo apt-get install docker-compose

# Step 4: Build and start services using Docker Compose
# Step 5: Build and start services using Docker Compose
- name: Build and Start Docker Compose
run: docker-compose up --build -d

# Step 5: Wait for PostgreSQL to be ready
# Step 6: Wait for PostgreSQL to be ready
- name: Wait for PostgreSQL
run: |
until docker-compose exec -T postgres pg_isready -h postgres -U indexer -d indexer; do
echo "Waiting for PostgreSQL...";
sleep 3;
done
until docker-compose exec -T postgres pg_isready -h postgres -U indexer -d indexer; do
echo "Waiting for PostgreSQL...";
sleep 3;
done
# Step 6: Check Lazy Indexer logs (optional for debugging)
# Step 7: Check Lazy Indexer logs (optional for debugging)
- name: Check Lazy Indexer logs
run: docker-compose logs lazy-indexer

# Step 7: Retry migration for Lazy Indexer
# Step 8: Retry migration for Lazy Indexer
- name: Run migration
run: |
for i in {1..10}; do
docker-compose exec -T lazy-indexer yarn migrate && break || (echo "Retrying migration in 5 seconds..." && sleep 5);
done
# Step 8: Log in to Docker Hub using secrets
# Step 9: Log in to Docker Hub using secrets
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

# Step 9: Push the Docker image to Docker Hub using the secret username
# Step 10: Build and Push multi-platform Docker image
- name: Build and Push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/lazy-indexer:latest-1
platforms: linux/amd64,linux/arm64
tags: ${{ secrets.DOCKER_USERNAME }}/lazy-indexer:latest

# Step 10: Verify the image exists on Docker Hub using the secret username
# Step 11: Verify the image exists on Docker Hub using the secret username
- name: Image exists on Docker Hub
run: docker pull ${{ secrets.DOCKER_USERNAME }}/lazy-indexer:latest-1
run: docker pull ${{ secrets.DOCKER_USERNAME }}/lazy-indexer:latest

0 comments on commit 3971412

Please sign in to comment.