Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pipeline fix #44

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 0 additions & 43 deletions .github/workflows/api.yml

This file was deleted.

17 changes: 10 additions & 7 deletions .github/workflows/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,11 @@ on:
push:
branches: [ "master" ]
paths:
- 'src/Argon.Api/**'
- 'src/Argon.Contracts/**'
- 'src/ServiceDefaults/**'
- 'src/**/**
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix YAML syntax and optimize path pattern

The path pattern has two issues:

  1. Missing closing quote which causes YAML syntax error
  2. The double ** pattern is redundant

Apply this diff to fix the syntax and optimize the pattern:

-      - 'src/**/**
+      - 'src/**'

Also applies to: 11-11

pull_request:
branches: [ "master" ]
paths:
- 'src/Argon.Api/**'
- 'src/Argon.Contracts/**'
- 'src/ServiceDefaults/**'
- 'src/**/**
workflow_dispatch:

jobs:
Expand All @@ -34,10 +30,17 @@ jobs:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.ARGON_GHCR_PAT }}
- name: Build and push
- name: Build and push api
uses: docker/build-push-action@v2
with:
context: .
file: ./src/Argon.Api/Dockerfile
push: true
tags: ghcr.io/argon-chat/orleans:${{ github.run_number }}
- name: Build and push contracts
uses: docker/build-push-action@v2
with:
context: .
file: ./src/Argon.Entry/Dockerfile
push: true
tags: ghcr.io/argon-chat/entry:${{ github.run_number }}
Comment on lines +33 to +46
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Enhance Docker build configuration for better security and efficiency

Several improvements can be made to the Docker build steps:

  1. Update to latest docker/build-push-action
  2. Add SHA and latest tags
  3. Specify platform
  4. Enable build caching

Apply these changes to both build steps:

       - name: Build and push api
-        uses: docker/build-push-action@v2
+        uses: docker/build-push-action@v5
         with:
           context: .
           file: ./src/Argon.Api/Dockerfile
           push: true
-          tags: ghcr.io/argon-chat/orleans:${{ github.run_number }}
+          tags: |
+            ghcr.io/argon-chat/orleans:${{ github.run_number }}
+            ghcr.io/argon-chat/orleans:${{ github.sha }}
+            ghcr.io/argon-chat/orleans:latest
+          platforms: linux/amd64,linux/arm64
+          cache-from: type=gha
+          cache-to: type=gha,mode=max

       - name: Build and push contracts
-        uses: docker/build-push-action@v2
+        uses: docker/build-push-action@v5
         with:
           context: .
           file: ./src/Argon.Entry/Dockerfile
           push: true
-          tags: ghcr.io/argon-chat/entry:${{ github.run_number }}
+          tags: |
+            ghcr.io/argon-chat/entry:${{ github.run_number }}
+            ghcr.io/argon-chat/entry:${{ github.sha }}
+            ghcr.io/argon-chat/entry:latest
+          platforms: linux/amd64,linux/arm64
+          cache-from: type=gha
+          cache-to: type=gha,mode=max
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Build and push api
uses: docker/build-push-action@v2
with:
context: .
file: ./src/Argon.Api/Dockerfile
push: true
tags: ghcr.io/argon-chat/orleans:${{ github.run_number }}
- name: Build and push contracts
uses: docker/build-push-action@v2
with:
context: .
file: ./src/Argon.Entry/Dockerfile
push: true
tags: ghcr.io/argon-chat/entry:${{ github.run_number }}
- name: Build and push api
uses: docker/build-push-action@v5
with:
context: .
file: ./src/Argon.Api/Dockerfile
push: true
tags: |
ghcr.io/argon-chat/orleans:${{ github.run_number }}
ghcr.io/argon-chat/orleans:${{ github.sha }}
ghcr.io/argon-chat/orleans:latest
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build and push contracts
uses: docker/build-push-action@v5
with:
context: .
file: ./src/Argon.Entry/Dockerfile
push: true
tags: |
ghcr.io/argon-chat/entry:${{ github.run_number }}
ghcr.io/argon-chat/entry:${{ github.sha }}
ghcr.io/argon-chat/entry:latest
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max