Skip to content

Conversation

@AtMrun
Copy link
Collaborator

@AtMrun AtMrun commented Oct 9, 2025

No description provided.

Copilot AI review requested due to automatic review settings October 9, 2025 10:16
Comment on lines +16 to +50
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/[email protected]
with:
fetch-depth: 0
- name: Discover apps (directories with pyproject.toml)
id: set-matrix
shell: bash
run: |
set -eo pipefail
mapfile -t files < <(git ls-files -- '**/pyproject.toml' 'pyproject.toml' | sed 's|^./||' || true)
if [ ${#files[@]} -eq 0 ]; then
echo 'matrix=[]' >> "$GITHUB_OUTPUT"
exit 0
fi
json="["
for f in "${files[@]}"; do
dir=$(dirname "$f")
if [ "$dir" = "." ]; then
name="root"
path="."
else
name=$(basename "$dir")
path="$dir"
fi
json="$json{\"name\":\"$name\",\"path\":\"$path\"},"
done
json="${json%,}"
json="$json]"
echo "matrix=$json" >> "$GITHUB_OUTPUT"
- name: Show discovered apps
run: echo '${{ steps.set-matrix.outputs.matrix }}'
build:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
Comment on lines +51 to +135
runs-on: ubuntu-latest
needs: discover-apps
strategy:
fail-fast: false
matrix:
app: ${{ fromJson(needs.discover-apps.outputs.matrix) }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
timeout-minutes: 20 # Increased from 10 to handle multi-platform builds
steps:
- uses: actions/[email protected]
with:
fetch-depth: 0

- name: Get branch name
run: echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT
id: get_branch

- run: echo "REPOSITORY_NAME=`echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}' | sed -e "s/:refs//"`" >> $GITHUB_ENV
shell: bash

- name: Get version tag
run: echo "version=$(echo `git ls-remote https://${{ secrets.ORG_PAT_GITHUB }}@github.com/atlanhq/${REPOSITORY_NAME}.git ${{ steps.get_branch.outputs.branch }} | awk '{ print $1}' | cut -c1-7`)abcd" >> $GITHUB_OUTPUT
id: get_version

- name: Lowercase branch name
run: echo "lowercase_branch=$(echo '${{ steps.get_branch.outputs.branch }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT
id: get_lowercase_branch

- name: Set up Buildx
id: buildx
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0 https://github.com/docker/setup-buildx-action/releases/tag/v3.10.0

- name: Login to GitHub Registry
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0 https://github.com/docker/login-action/releases/tag/v3.4.0
with:
registry: ghcr.io
username: $GITHUB_ACTOR
password: ${{ secrets.ORG_PAT_GITHUB }}

- name: Build and push docker image to GHCR
id: ghcr_docker_build
uses: docker/build-push-action@1dc73863535b631f98b2378be8619f83b136f4a0 # v6.17.0 https://github.com/docker/build-push-action/releases/tag/v6.17.0
with:
context: .
file: ./Dockerfile
push: true
platforms: linux/amd64,linux/arm64
tags: |
ghcr.io/atlanhq/${{ github.event.repository.name }}-${{ matrix.app.name }}-${{ steps.get_lowercase_branch.outputs.lowercase_branch }}:latest
ghcr.io/atlanhq/${{ github.event.repository.name }}-${{ matrix.app.name }}-${{ steps.get_lowercase_branch.outputs.lowercase_branch }}:${{ steps.get_version.outputs.version }}
build-args: |
ACCESS_TOKEN_USR=$GITHUB_ACTOR
ACCESS_TOKEN_PWD=${{ secrets.ORG_PAT_GITHUB }}
APP_PATH=${{ matrix.app.path }}
env:
DOCKER_CLIENT_TIMEOUT: 600 # Increased timeout
COMPOSE_HTTP_TIMEOUT: 600

# Add Docker Hub login
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: atlanhq
password: ${{ secrets.DOCKER_HUB_PAT_RW }}

- name: Build and push docker image to Docker Hub
id: docker_build
uses: docker/build-push-action@1dc73863535b631f98b2378be8619f83b136f4a0 # v6.17.0 https://github.com/docker/build-push-action/releases/tag/v6.17.0
with:
context: .
file: ./Dockerfile
push: true
platforms: linux/amd64,linux/arm64
tags: |
registry-1.docker.io/atlanhq/${{ github.event.repository.name }}-${{ matrix.app.name }}:${{ steps.get_branch.outputs.branch }}-${{ steps.get_version.outputs.version }}
registry-1.docker.io/atlanhq/${{ github.event.repository.name }}-${{ matrix.app.name }}:${{ steps.get_branch.outputs.branch }}-latest
build-args: |
ACCESS_TOKEN_USR=$GITHUB_ACTOR
ACCESS_TOKEN_PWD=${{ secrets.ORG_PAT_GITHUB }}
APP_PATH=${{ matrix.app.path }}
env:
DOCKER_CLIENT_TIMEOUT: 300
COMPOSE_HTTP_TIMEOUT: 300

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements Docker image building for individual apps by modifying the Dockerfile to accept a build argument for specifying which app directory to build, and adding a GitHub Actions workflow that discovers all apps with pyproject.toml files and builds separate Docker images for each.

  • Dockerfile now accepts an APP_PATH build argument to specify which app directory to build
  • Added GitHub Actions workflow to automatically discover apps and build Docker images for each
  • Made DAPR app ID configurable via environment variable

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
Dockerfile Modified to accept APP_PATH build argument and copy files from specific app directories
.github/workflows/build-image.yaml New workflow for discovering apps and building Docker images with matrix strategy

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.


# Add Docker Hub login
- name: Login to Docker Hub
uses: docker/login-action@v3
Copy link

Copilot AI Oct 9, 2025

Choose a reason for hiding this comment

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

This action uses a non-pinned version tag 'v3' while other Docker actions in the same workflow use pinned SHA hashes. For consistency and security, consider using a pinned SHA hash like the other actions.

Suggested change
uses: docker/login-action@v3
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0 https://github.com/docker/login-action/releases/tag/v3.4.0

Copilot uses AI. Check for mistakes.

# Install dependencies first (better caching)
COPY --chown=appuser:appuser pyproject.toml uv.lock README.md ./
COPY --chown=appuser:appuser ${APP_PATH}/pyproject.toml ${APP_PATH}/uv.lock ./
Copy link

Copilot AI Oct 9, 2025

Choose a reason for hiding this comment

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

The COPY command will fail if uv.lock doesn't exist in the APP_PATH directory. Consider making uv.lock optional or ensuring it exists in all app directories.

Suggested change
COPY --chown=appuser:appuser ${APP_PATH}/pyproject.toml ${APP_PATH}/uv.lock ./
COPY --chown=appuser:appuser ${APP_PATH}/pyproject.toml ./
RUN [ -f "${APP_PATH}/uv.lock" ] && cp "${APP_PATH}/uv.lock" ./uv.lock || true && \
chown appuser:appuser ./uv.lock 2>/dev/null || true

Copilot uses AI. Check for mistakes.
matrix:
app: ${{ fromJson(needs.discover-apps.outputs.matrix) }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Copy link

Copilot AI Oct 9, 2025

Choose a reason for hiding this comment

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

The concurrency group should include the matrix app name to prevent different app builds from canceling each other. Consider changing to: group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.app.name }}

Suggested change
group: ${{ github.workflow }}-${{ github.ref }}
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.app.name }}

Copilot uses AI. Check for mistakes.
@github-actions
Copy link

github-actions bot commented Oct 9, 2025

📦 Trivy Vulnerability Scan Results

Schema Version Created At Artifact Type
2 2025-10-09T10:36:26.352479858Z . filesystem

Report Summary

Target Type Vulnerabilities . filesystem ✅ None found

Scan Result Details

✅ No vulnerabilities found during the scan for ..

@github-actions
Copy link

github-actions bot commented Oct 9, 2025

📦 Trivy Secret Scan Results

Schema Version Created At Artifact Type
2 2025-10-09T10:36:32.002411165Z . filesystem

Report Summary

Target Type Secrets . filesystem ✅ None found

Scan Result Details

✅ No secrets found during the scan for ..

@AtMrun AtMrun changed the title Budlding docker image for each app Building docker image for each app Oct 9, 2025
Copy link
Member

Choose a reason for hiding this comment

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

@AtMrun be careful with this command, the apps have been upgraded to Dapr 1.16.0 recently so we can't change this line

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants