-
Notifications
You must be signed in to change notification settings - Fork 1
Add Dockerfile and publish docker image #4
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
Changes from all commits
00ecfe6
2048230
3d85ab5
1fc6032
7849725
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,76 @@ | ||||||||||||||||||||||
| name: Publish Docker image on GitHub Container Registry | ||||||||||||||||||||||
| # https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| on: | ||||||||||||||||||||||
| workflow_dispatch: | ||||||||||||||||||||||
| push: | ||||||||||||||||||||||
| tags: | ||||||||||||||||||||||
| - "v*.*.*" | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| env: | ||||||||||||||||||||||
| REGISTRY: ghcr.io | ||||||||||||||||||||||
| IMAGE_NAME: ${{ github.repository }} | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||
| build-and-publish-image: | ||||||||||||||||||||||
| runs-on: ubuntu-24.04 | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| # Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job. | ||||||||||||||||||||||
| permissions: | ||||||||||||||||||||||
| contents: read | ||||||||||||||||||||||
| packages: write | ||||||||||||||||||||||
| attestations: write | ||||||||||||||||||||||
| id-token: write | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| steps: | ||||||||||||||||||||||
| - name: Checkout repository | ||||||||||||||||||||||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||||||||||||||||||||||
| with: | ||||||||||||||||||||||
| persist-credentials: false # do not keep the token around | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| # Uses the `docker/login-action` action to log in to the Container registry using | ||||||||||||||||||||||
| # the account and password that will publish the packages. | ||||||||||||||||||||||
| - name: Log in to the Container registry | ||||||||||||||||||||||
| uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0 | ||||||||||||||||||||||
| with: | ||||||||||||||||||||||
| registry: ${{ env.REGISTRY }} | ||||||||||||||||||||||
| username: ${{ github.actor }} | ||||||||||||||||||||||
| password: ${{ secrets.GITHUB_TOKEN }} | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| - name: Extract metadata (tags, labels) for image | ||||||||||||||||||||||
| id: meta | ||||||||||||||||||||||
| uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0 | ||||||||||||||||||||||
| with: | ||||||||||||||||||||||
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||||||||||||||||||||||
| tags: | | ||||||||||||||||||||||
| type=sha,event=workflow_dispatch,enable=${{ !startsWith(github.ref, 'refs/tags/') }} | ||||||||||||||||||||||
| type=semver,pattern={{version}} | ||||||||||||||||||||||
| labels: | | ||||||||||||||||||||||
| org.opencontainers.image.title=HealthyCode | ||||||||||||||||||||||
| org.opencontainers.image.description=Client to generate GrimoireLab metrics for Project Health using the software analytics platform GrimoireLab | ||||||||||||||||||||||
| org.opencontainers.image.licenses=GPL-3.0-or-later | ||||||||||||||||||||||
| annotations: | | ||||||||||||||||||||||
| org.opencontainers.image.title=HealthyCode | ||||||||||||||||||||||
| org.opencontainers.image.description=Client to generate GrimoireLab metrics for Project Health using the software analytics platform GrimoireLab | ||||||||||||||||||||||
| org.opencontainers.image.licenses=GPL-3.0-or-later | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
Member
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. Also, auto generated OCI labels/annotations won’t be able to accurately capture the license, description, and title.
Suggested change
Contributor
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. The license should be GPL-3.0-or-later, I think. https://github.com/aboutcode-org/healthycode/blob/main/pyproject.toml#L9
Member
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.
Contributor
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. I think the license specifies: https://github.com/aboutcode-org/healthycode/tree/main?tab=GPL-3.0-1-ov-file |
||||||||||||||||||||||
| - name: Set up Docker Buildx | ||||||||||||||||||||||
| uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0 | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| - name: Build and push Docker image | ||||||||||||||||||||||
| id: push | ||||||||||||||||||||||
| uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2 | ||||||||||||||||||||||
| with: | ||||||||||||||||||||||
| context: . | ||||||||||||||||||||||
| push: true | ||||||||||||||||||||||
| tags: | | ||||||||||||||||||||||
| ${{ steps.meta.outputs.tags }} | ||||||||||||||||||||||
| labels: ${{ steps.meta.outputs.labels }} | ||||||||||||||||||||||
| annotations: ${{ steps.meta.outputs.annotations }} | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| - name: Generate artifact attestation for Docker image | ||||||||||||||||||||||
| uses: actions/attest-build-provenance@a2bbfa25375fe432b6a289bc6b6cd05ecd0c4c32 # v4.1.0 | ||||||||||||||||||||||
| with: | ||||||||||||||||||||||
| subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||||||||||||||||||||||
| subject-digest: ${{ steps.push.outputs.digest }} | ||||||||||||||||||||||
| push-to-registry: true | ||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| FROM python:3.13-slim | ||
|
|
||
|
ziadhany marked this conversation as resolved.
|
||
| LABEL org.opencontainers.image.source="https://github.com/aboutcode-org/healthycode" | ||
| LABEL org.opencontainers.image.description="Client to generate GrimoireLab metrics for Project Health using the software analytics platform GrimoireLab" | ||
| LABEL org.opencontainers.image.licenses="GPL-3.0-or-later" | ||
|
|
||
| RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
| git build-essential \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| WORKDIR /opt/healthycode | ||
|
|
||
| RUN pip install --no-cache-dir poetry | ||
| RUN poetry config virtualenvs.in-project true | ||
|
|
||
| COPY pyproject.toml poetry.lock* ./ | ||
| RUN poetry install --no-interaction --no-ansi --no-root | ||
|
|
||
| COPY . . | ||
|
|
||
| RUN poetry build -f wheel \ | ||
| && .venv/bin/pip install dist/*.whl | ||


Uh oh!
There was an error while loading. Please reload this page.