-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
945e216
commit ad60418
Showing
1 changed file
with
80 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,55 +26,107 @@ jobs: | |
name: Build and validate Docker image | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Checkout Code | ||
# - | ||
# name: Checkout Code | ||
# uses: actions/checkout@v4 | ||
# - | ||
# name: Set up Docker Buildx | ||
# uses: docker/setup-buildx-action@v3 | ||
# with: | ||
# platforms: linux/amd64,linux/arm64 | ||
# - | ||
# name: Login to Github Container Registry | ||
# uses: docker/login-action@v3 | ||
# with: | ||
# registry: ghcr.io | ||
# username: ${{ github.repository_owner }} | ||
# password: ${{ secrets.GITHUB_TOKEN }} | ||
# - | ||
# name: Build and push Docker image (dependencies) | ||
# uses: docker/build-push-action@v6 | ||
# with: | ||
# target: deps | ||
# context: . | ||
# push: true | ||
# build-args: | | ||
# BUILDKIT_INLINE_CACHE=1 | ||
# SHA=${{ github.sha }} | ||
# cache-from: | | ||
# ${{ env.REGISTRY }}:deps | ||
# tags: | | ||
# ${{ env.REGISTRY }}:deps | ||
# - | ||
# name: Build and push Docker image (application) | ||
# uses: docker/build-push-action@v6 | ||
# with: | ||
# target: app | ||
# context: . | ||
# push: true | ||
# build-args: | | ||
# BUILDKIT_INLINE_CACHE=1 | ||
# SHA=${{ github.sha }} | ||
# cache-from: | | ||
# ${{ env.REGISTRY }}:${{ github.sha }} | ||
# ${{ env.REGISTRY }}:latest | ||
# tags: | | ||
# ${{ env.REGISTRY }}:${{ github.sha }} | ||
|
||
|
||
# Checkout the repository to the GitHub Actions runner | ||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
- | ||
name: Set up Docker Buildx | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
|
||
# Create and boot Docker image builder | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
with: | ||
platforms: linux/amd64,linux/arm64 | ||
- | ||
name: Login to Github Container Registry | ||
version: v0.9.1 | ||
|
||
# Login to the container registry | ||
- name: Login to Github Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- | ||
name: Build and push Docker image (dependencies) | ||
uses: docker/build-push-action@v6 | ||
with: | ||
target: deps | ||
context: . | ||
push: true | ||
build-args: | | ||
BUILDKIT_INLINE_CACHE=1 | ||
SHA=${{ github.sha }} | ||
cache-from: | | ||
${{ env.REGISTRY }}:deps | ||
tags: | | ||
${{ env.REGISTRY }}:deps | ||
- | ||
name: Build and push Docker image (application) | ||
|
||
# Build and push image | ||
# - name: Build and push dependencies | ||
# uses: docker/build-push-action@v6 | ||
# with: | ||
# target: deps | ||
# context: . | ||
# push: true | ||
# build-args: | | ||
# BUILDKIT_INLINE_CACHE=1 | ||
# SHA=${{ github.event.pull_request.head.sha }} | ||
# cache-from: | | ||
# ${{ env.DOCKER_IMAGE }}:deps | ||
# tags: ${{ env.DOCKER_IMAGE }}:deps | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
target: app | ||
context: . | ||
push: true | ||
build-args: | | ||
BUILDKIT_INLINE_CACHE=1 | ||
SHA=${{ github.sha }} | ||
SHA=${{ github.event.pull_request.head.sha }} | ||
cache-from: | | ||
${{ env.REGISTRY }}:${{ github.sha }} | ||
${{ env.REGISTRY }}:latest | ||
${{ env.DOCKER_IMAGE }}:${{ github.event.pull_request.head.sha }} | ||
tags: | | ||
${{ env.REGISTRY }}:${{ github.sha }} | ||
${{ env.DOCKER_IMAGE }}:${{ github.event.pull_request.head.sha }} | ||
- | ||
name: Run Trivy vulnerability scanner | ||
uses: aquasecurity/[email protected] | ||
with: | ||
image-ref: ${{ env.REGISTRY }}:${{ github.sha }} | ||
# image-ref: ${{ env.REGISTRY }}:${{ github.sha }} | ||
image-ref: ${{ env.REGISTRY }}:${{ github.event.pull_request.head.sha }} | ||
format: table | ||
exit-code: 1 | ||
ignore-unfixed: true | ||
|