File tree Expand file tree Collapse file tree 1 file changed +32
-3
lines changed
Expand file tree Collapse file tree 1 file changed +32
-3
lines changed Original file line number Diff line number Diff line change @@ -3,12 +3,39 @@ name: Build and Push Docker Image
33on :
44 push :
55 branches : [ main ]
6+ pull_request :
7+ branches : [ main ]
68 release :
79 types : [ published ]
810
911jobs :
10- build-and-push :
12+
13+ build-test :
14+ runs-on : ubuntu-latest
15+
16+ steps :
17+ - name : Checkout repository
18+ uses : actions/checkout@v4
19+
20+ - name : Build Docker image
21+ run : |
22+ docker build -f ./docker/Dockerfile -t tradenode:test .
23+
24+ - name : Test Docker image
25+ run : |
26+ docker run --rm tradenode:test > /tmp/test.log
27+
28+ if grep -q "CONNECTING TO MONGODB" /tmp/test.log; then
29+ echo "Build successful"
30+ else
31+ echo "Build failed!"
32+ exit 1
33+ fi
34+
35+ push-to-ghcr :
1136 runs-on : ubuntu-latest
37+ if : github.ref == 'refs/heads/main'
38+ needs : build-test
1239 permissions :
1340 contents : read
1441 packages : write
@@ -30,10 +57,12 @@ jobs:
3057 with :
3158 images : ghcr.io/${{ github.repository }}
3259
33- - name : Build and push Docker image
34- uses : docker/build-push-action@v5
60+ - name : Build and push
61+ uses : docker/build-push-action@v6
3562 with :
3663 context : .
64+ platforms : linux/amd64,linux/arm64
65+ file : ./docker/Dockerfile
3766 push : true
3867 tags : |
3968 ghcr.io/${{ github.repository }}:latest
You can’t perform that action at this time.
0 commit comments