File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66 tags : ['v*']
77
88jobs :
9- Order_Service_Build :
9+ build :
1010 runs-on : ubuntu-latest
1111 defaults :
1212 run :
2121 - run : npm ci
2222 - run : npm run build --if-present
2323 - run : cat Dockerfile
24+
25+ build-and-push :
26+ needs : build
27+ runs-on : ubuntu-latest
28+ working-directory : 1-order-service
29+ if : github.ref == 'refs/heads/main' || 'refs/heads/ci' || startsWith(github.ref, 'refs/tags/')
30+ steps :
31+ - uses : actions/checkout@v4
32+
33+ - name : Set up Docker Buildx
34+ uses : docker/setup-buildx-action@v3
35+
36+ - name : Login to Docker Hub
37+ uses : docker/login-action@v3
38+ with :
39+ username : ${{ secrets.DOCKER_USERNAME }}
40+ password : ${{ secrets.DOCKER_PASSWORD }}
41+ - name : Set environment variables
42+ run : |
43+ echo "IMAGE_NAME=${{ secrets.DOCKER_USERNAME }}/${{ vars.IMAGE_NAME_1 }}" >> $GITHUB_ENV
44+ echo "IMAGE_TAG=$(echo $GITHUB_SHA | cut -c1-7)" >> $GITHUB_ENV
45+ if [[ $GITHUB_REF == refs/tags/* ]]; then
46+ echo "IMAGE_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
47+ fi
48+ - name : Build and Push Docker Image
49+ uses : docker/build-push-action@v5
50+ with :
51+ context : .
52+ push : ${{ github.ref == 'refs/heads/main' ||'refs/heads/ci' || startsWith(github.ref, 'refs/tags/') }}
53+ tags : |
54+ ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
55+ platforms : linux/amd64
56+ cache-from : type=gha
57+ cache-to : type=gha,mode=max
You can’t perform that action at this time.
0 commit comments