-
Notifications
You must be signed in to change notification settings - Fork 22
feat: add ghcr image publishing #1735
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
Open
MarceloRobert
wants to merge
1
commit into
kernelci:main
Choose a base branch
from
MarceloRobert:exp/ghcr
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+210
−6
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,128 @@ | ||
| name: Publish GHCR Images | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
|
|
||
| concurrency: | ||
| group: publish-ghcr-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| permissions: | ||
| contents: read | ||
| packages: write | ||
|
|
||
| env: | ||
| REGISTRY: ghcr.io | ||
|
|
||
| jobs: | ||
| build-and-push-backend: | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| digest: ${{ steps.build.outputs.digest }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Compute image prefix | ||
| id: meta | ||
| run: echo "prefix=${REGISTRY}/${GITHUB_REPOSITORY,,}" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Log in to GHCR | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: ${{ env.REGISTRY }} | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
||
| - name: Build and push backend image | ||
| id: build | ||
| uses: docker/build-push-action@v6 | ||
| with: | ||
| context: ./backend | ||
| push: true | ||
| tags: | | ||
| ${{ steps.meta.outputs.prefix }}/dashboard-backend:latest | ||
| ${{ steps.meta.outputs.prefix }}/dashboard-backend:${{ github.sha }} | ||
|
|
||
| build-and-push-dashboard: | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| digest: ${{ steps.build.outputs.digest }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Compute image prefix | ||
| id: meta | ||
| run: echo "prefix=${REGISTRY}/${GITHUB_REPOSITORY,,}" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Log in to GHCR | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: ${{ env.REGISTRY }} | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
||
| - name: Build and push dashboard image | ||
| id: build | ||
| uses: docker/build-push-action@v6 | ||
| with: | ||
| context: . | ||
| file: ./dashboard/Dockerfile | ||
| push: true | ||
| tags: | | ||
| ${{ steps.meta.outputs.prefix }}/dashboard-frontend:latest | ||
| ${{ steps.meta.outputs.prefix }}/dashboard-frontend:${{ github.sha }} | ||
|
|
||
| build-and-push-proxy: | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| digest: ${{ steps.build.outputs.digest }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Compute image prefix | ||
| id: meta | ||
| run: echo "prefix=${REGISTRY}/${GITHUB_REPOSITORY,,}" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Log in to GHCR | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: ${{ env.REGISTRY }} | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
||
| - name: Build and push proxy image | ||
| id: build | ||
| uses: docker/build-push-action@v6 | ||
| with: | ||
| context: ./proxy | ||
| push: true | ||
| tags: | | ||
| ${{ steps.meta.outputs.prefix }}/dashboard-proxy:latest | ||
| ${{ steps.meta.outputs.prefix }}/dashboard-proxy:${{ github.sha }} | ||
|
|
||
| verify: | ||
| if: always() | ||
| needs: | ||
| - build-and-push-backend | ||
| - build-and-push-dashboard | ||
| - build-and-push-proxy | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Image publish summary | ||
| run: | | ||
| echo "### Published GHCR Images" >> "$GITHUB_STEP_SUMMARY" | ||
| echo "" >> "$GITHUB_STEP_SUMMARY" | ||
| echo "| Image | Digest |" >> "$GITHUB_STEP_SUMMARY" | ||
| echo "| ----- | ------ |" >> "$GITHUB_STEP_SUMMARY" | ||
| echo "| dashboard-backend | \`${{ needs.build-and-push-backend.outputs.digest }}\` |" >> "$GITHUB_STEP_SUMMARY" | ||
| echo "| dashboard-frontend | \`${{ needs.build-and-push-dashboard.outputs.digest }}\` |" >> "$GITHUB_STEP_SUMMARY" | ||
| echo "| dashboard-proxy | \`${{ needs.build-and-push-proxy.outputs.digest }}\` |" >> "$GITHUB_STEP_SUMMARY" | ||
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| __pycache__ | ||
| .pytest_cache | ||
| *.pyc | ||
|
|
||
| tests_submissions |
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -45,11 +45,6 @@ RUN O='0 1 2' \ | |
| PYTHONOPTIMIZE=$N poetry run python -m compileall -q $D || exit 1; \ | ||
| done | ||
|
|
||
| ARG BACKEND_VOLUME_DIR | ||
| ENV BACKEND_VOLUME_DIR=${BACKEND_VOLUME_DIR} | ||
| RUN echo "Building with volume on: $BACKEND_VOLUME_DIR" | ||
| VOLUME ${BACKEND_VOLUME_DIR} | ||
|
Collaborator
Author
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. Does this affect our old composes? Including the composes for the other parts of the project |
||
|
|
||
| # Expose both application and metrics ports | ||
| EXPOSE 8000 8001 | ||
|
|
||
|
|
||
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| volumes: | ||
| backend-data: | ||
| runtime-data: | ||
| static-data: | ||
| dashboard-db-data: | ||
|
|
||
| networks: | ||
| public: | ||
| private: | ||
|
|
||
| services: | ||
| dashboard_db: | ||
| image: postgres:17 | ||
| env_file: | ||
| - .env.db | ||
| volumes: | ||
| - dashboard-db-data:/var/lib/postgresql/data | ||
| networks: | ||
| - private | ||
| ports: | ||
| - "5434:5432" | ||
|
|
||
| redis: | ||
| image: redis:8.0-M04-alpine | ||
| restart: always | ||
| networks: | ||
| - private | ||
| ports: | ||
| - 6379:6379 | ||
|
|
||
| backend: | ||
| image: ${IMAGE_REGISTRY:-ghcr.io}/${IMAGE_OWNER}/${IMAGE_REPOSITORY}/dashboard-backend:${IMAGE_TAG} | ||
| volumes: | ||
| - backend-data:${BACKEND_VOLUME_DIR:-/volume_data} | ||
| restart: always | ||
| networks: | ||
| - private | ||
| - public | ||
| ports: | ||
| - target: 8000 | ||
| published: 8000 | ||
| protocol: tcp | ||
| - target: 8001 | ||
| published: 8001 | ||
| protocol: tcp | ||
| depends_on: | ||
| - redis | ||
| - dashboard_db | ||
| env_file: | ||
| - .env.backend | ||
| environment: | ||
| DB_DEFAULT_HOST: ${DB_DEFAULT_HOST:-dashboard_db} | ||
|
|
||
| dashboard: | ||
| image: ${IMAGE_REGISTRY:-ghcr.io}/${IMAGE_OWNER}/${IMAGE_REPOSITORY}/dashboard-frontend:${IMAGE_TAG} | ||
| volumes: | ||
| - static-data:/data/static | ||
|
|
||
| proxy: | ||
| image: ${IMAGE_REGISTRY:-ghcr.io}/${IMAGE_OWNER}/${IMAGE_REPOSITORY}/dashboard-proxy:${IMAGE_TAG} | ||
| restart: always | ||
| depends_on: | ||
| - backend | ||
| - dashboard | ||
| networks: | ||
| - public | ||
| volumes: | ||
| - static-data:/data/static | ||
| ports: | ||
| - target: 80 | ||
| published: 80 | ||
| protocol: tcp | ||
| env_file: | ||
| - .env.proxy |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
check: is it correct to use
,,(two commas)?