@@ -57,17 +57,16 @@ jobs:
5757 username : ${{ secrets.DOCKER_USERNAME }}
5858 password : ${{ secrets.DOCKER_PASSWORD }}
5959
60- - name : Build and push server with unique tag
61- uses : docker/build-push-action@v4
60+ - name : Build and push Docker images with unique tag
61+ uses : docker/bake-action@v2.3.0
62+ env :
63+ IMAGE_TAG : ${{ steps.tag.outputs.tag }}
6264 with :
63- context : ./server
65+ files : ./server/docker-bake.hcl
6466 push : true
65- tags : |
66- paymesh/server:${{ steps.tag.outputs.tag }}
67- paymesh/server:latest
68- cache-from : type=gha
69- cache-to : type=gha,mode=max
70- platforms : linux/amd64
67+ set : |
68+ *.cache-from=type=gha
69+ *.cache-to=type=gha,mode=max
7170
7271 - name : Build and push indexer with unique tag
7372 uses : docker/build-push-action@v4
@@ -153,17 +152,21 @@ jobs:
153152 tail -n +6 | \
154153 xargs -r docker rmi || true
155154
156- # Remove dangling images
155+ # Remove dangling images
157156 docker image prune -f
158157
159158 echo "Deployment complete!"
160159 echo "Running containers:"
161160 docker ps
162161
163- - name : Copy docker-compose.yml to indexer droplet
164- run : sshpass -v -p ${{ secrets.INDEXER_DROPLET_PASSWORD }} scp -o StrictHostKeyChecking=no server/docker-compose.yml root@${{ vars.INDEXER_DROPLET_IP }}:~
165-
166- - name : Deploy with environment variables
162+ - name : Copy docker-compose.yml to paymesh indexer droplet
163+ run : |
164+ sshpass -v -p ${{ secrets.INDEXER_DROPLET_PASSWORD }} \
165+ scp -o StrictHostKeyChecking=no \
166+ the_last_indexer/docker-compose.yml \
167+ root@${{ vars.INDEXER_DROPLET_IP }}:~
168+
169+ - name : Deploy indexer with environment variables
167170 uses : appleboy/ssh-action@master
168171 env :
169172 IMAGE_TAG : ${{ needs.build.outputs.image_tag }}
@@ -174,33 +177,32 @@ jobs:
174177 envs : IMAGE_TAG
175178 script : |
176179 cd ~
177-
180+
178181 # Create environment file
179182 cat > .env <<EOL
180183 DNA_TOKEN=${{ secrets.DNA_TOKEN }}
181184 API_URL=${{ secrets.API_URL }}
182185 PAYMESH_API_KEY=${{ secrets.PAYMESH_API_KEY }}
183186 IMAGE_TAG=${IMAGE_TAG}
184187 EOL
185-
186- echo "Deploying with image tag: ${IMAGE_TAG}"
187-
188- # Stop, pull new images , and restart
188+
189+ echo "Deploying indexer with image tag: ${IMAGE_TAG}"
190+
191+ # Stop, pull new image , and restart
189192 docker compose --env-file .env stop
190193 docker compose --env-file .env pull
191194 docker compose --env-file .env up -d
192-
195+
193196 # Cleanup old images - keep last 5 versions
194- echo "Cleaning up old images..."
197+ echo "Cleaning up old indexer images..."
195198 docker images "paymesh/the-last-indexer" --format "{{.Repository}}:{{.Tag}}" | \
196199 grep -v latest | \
197200 sort -r | \
198201 tail -n +6 | \
199202 xargs -r docker rmi || true
200-
203+
201204 # Remove dangling images
202205 docker image prune -f
203-
204- echo "Deployment complete!"
205- echo "Running containers:"
206- docker ps
206+
207+ echo "Indexer deployment complete!"
208+ docker ps
0 commit comments