-
Notifications
You must be signed in to change notification settings - Fork 0
ci: automate docker image builds to GHCR #21
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| name: Build Docker Images | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| image-tag: | ||
| required: true | ||
| type: string | ||
| description: "Docker image tag (example: main)" | ||
| apps: | ||
| required: true | ||
| type: string | ||
| description: "JSON array of apps to build" | ||
|
|
||
| jobs: | ||
| build-images: | ||
| name: Build ${{ matrix.app.name }} | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| packages: write | ||
| strategy: | ||
| matrix: | ||
| app: ${{ fromJson(inputs.apps) }} | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
Comment on lines
+29
to
+30
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: cat -n .github/workflows/docker-build-push.ymlRepository: evstack/atlas Length of output: 2187 Add QEMU setup before Docker Buildx for multi-platform builds. The workflow attempts to build for Suggested fix - name: Checkout
uses: actions/checkout@v4
+ - name: Set up QEMU
+ uses: docker/setup-qemu-action@v3
+
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3🤖 Prompt for AI Agents |
||
|
|
||
| - name: Log in to GHCR | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: ghcr.io | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Build and push ${{ matrix.app.name }} (targeted) | ||
| if: matrix.app.target != '' | ||
| uses: docker/build-push-action@v6 | ||
| with: | ||
| context: ${{ matrix.app.context }} | ||
| file: ${{ matrix.app.dockerfile }} | ||
| target: ${{ matrix.app.target }} | ||
| push: true | ||
| platforms: linux/amd64 | ||
| tags: ghcr.io/${{ github.repository_owner }}/${{ matrix.app.name }}:${{ inputs.image-tag }} | ||
|
|
||
| - name: Build and push ${{ matrix.app.name }} (default target) | ||
| if: matrix.app.target == '' | ||
| uses: docker/build-push-action@v6 | ||
| with: | ||
| context: ${{ matrix.app.context }} | ||
| file: ${{ matrix.app.dockerfile }} | ||
| push: true | ||
| platforms: linux/amd64 | ||
| tags: ghcr.io/${{ github.repository_owner }}/${{ matrix.app.name }}:${{ inputs.image-tag }} | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: evstack/atlas
Length of output: 961
🏁 Script executed:
Repository: evstack/atlas
Length of output: 2542
Gate image publishing on CI success with
needs.The docker job (lines 67-76) currently only checks the event and branch with
if: github.event_name == 'push' && github.ref == 'refs/heads/main'. This condition does not enforce job dependencies. Withoutneeds, the docker publish job can run in parallel with or independently of the backend tests (line 14) and frontend build (line 43), and will execute even if either fails. Addneeds: [backend, frontend]to ensure images are only published after both jobs succeed.Suggested fix
docker: name: Docker (GHCR) + needs: + - backend + - frontend if: github.event_name == 'push' && github.ref == 'refs/heads/main' uses: ./.github/workflows/docker-build-push.yml📝 Committable suggestion
🤖 Prompt for AI Agents