Skip to content
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
32 changes: 12 additions & 20 deletions .github/workflows/docker-build-and-scan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,20 @@ jobs:
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker Image
id: build-image
- name: Login to DockerHub
if: github.event_name == 'workflow_call'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build (and maybe push) Docker image
uses: docker/build-push-action@v6
with:
context: ${{ inputs.DOCKER_PATH_CONTEXT || env.DOCKER_PATH_CONTEXT }}
file: ${{ inputs.DOCKER_BUILD_DOCKERFILE || env.DOCKER_BUILD_DOCKERFILE }}
load: ${{ inputs.DOCKER_LOAD_BOOL || env.DOCKER_LOAD_BOOL }}
tags: ${{ inputs.DOCKER_TAGS || env.DOCKER_TAGS }}
context: ${{ github.event_name == 'workflow_call' && inputs.DOCKER_PATH_CONTEXT || env.DOCKER_PATH_CONTEXT }}
file: ${{ github.event_name == 'workflow_call' && inputs.DOCKER_BUILD_DOCKERFILE || env.DOCKER_BUILD_DOCKERFILE }}
load: ${{ github.event_name != 'workflow_call' }}
push: ${{ github.event_name == 'workflow_call' }}
tags: ${{ github.event_name == 'workflow_call' && inputs.DOCKER_TAGS || env.DOCKER_TAGS }}
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@0.33.1
with:
Expand All @@ -52,17 +58,3 @@ jobs:
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'
- name: Login to DockerHub
if: github.event_name == 'workflow_call'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push Docker image to DockerHub
if: github.event_name == 'workflow_call'
uses: docker/build-push-action@v6
with:
context: ${{ inputs.DOCKER_PATH_CONTEXT || env.DOCKER_PATH_CONTEXT }}
file: ${{ inputs.DOCKER_BUILD_DOCKERFILE || env.DOCKER_BUILD_DOCKERFILE }}
push: true
tags: ${{ inputs.DOCKER_TAGS || env.DOCKER_TAGS }}
3 changes: 2 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@ jobs:
docker-build-and-scan:
needs: Semantic-Release
uses: milsman2/python-app-template/.github/workflows/docker-build-and-scan.yaml@main
secrets: inherit
with:
DOCKER_PATH_CONTEXT: .
DOCKER_BUILD_DOCKERFILE: Dockerfile
DOCKER_LOAD_BOOL: true
DOCKER_TAGS: sample-python-app:${{ needs.Semantic-Release.outputs.tag }}
DOCKER_TAGS: milsman2/sample-python-app:${{ needs.Semantic-Release.outputs.tag }}
2 changes: 1 addition & 1 deletion src/sample_python_app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
def run_app():
console = Console()
f = Figlet(font="slant")
ascii_art = f.renderText("Hello, Synthwave!")
ascii_art = f.renderText(f"Welcome to {settings.APP_NAME}!")
console.print(f"[bold magenta]{ascii_art}[/bold magenta]")
logger = setup_logger(mode="silent")
logger.info(f"Starting {settings.APP_NAME}...")
Expand Down
Loading