diff --git a/.github/workflows/cd-build-image.yml b/.github/workflows/cd-build-image.yml new file mode 100644 index 0000000..d2b0aa0 --- /dev/null +++ b/.github/workflows/cd-build-image.yml @@ -0,0 +1,52 @@ +name: Build & Publish Docker Image + +on: + release: + types: [published] + +jobs: + deploy: + if: github.event.release.target_commitish == 'main' + name: Build & Deploy spacedf-backend Docker Image + runs-on: ubuntu-latest + + permissions: + contents: read + packages: write + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: ${{ github.event.release.tag_name }} + + # Login to GHCR + - name: Login to GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + # Generate Docker metadata + - name: Docker metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/${{ github.repository }} + tags: | + type=semver,pattern={{version}},value=${{ github.event.release.tag_name }} + type=semver,pattern={{major}}.{{minor}},value=${{ github.event.release.tag_name }} + type=semver,pattern={{major}},value=${{ github.event.release.tag_name }} + + # Build & Push image + - name: Build & Push Docker image + uses: docker/build-push-action@v5 + with: + context: . + file: ./Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + secrets: | + github_token=${{ secrets.GH_PAT }} diff --git a/CLA.md b/CLA.md index d90f836..419e02f 100644 --- a/CLA.md +++ b/CLA.md @@ -1,70 +1,87 @@ -Contributor License Agreement (CLA) +# Contributor License Agreement (CLA) -Version 1.0 +**Version 1.0** -This Contributor License Agreement ("Agreement") is entered into by you ("Contributor") and Digital Fortress ("Company") regarding your contributions to the SpaceDF project ("Project"). +This Contributor License Agreement (“**Agreement**”) is entered into by **you** (“**Contributor**”) and **Digital Fortress** (“**Company**”) regarding your contributions to the **SpaceDF** project (“**Project**”). -By submitting any contribution to the Project, you agree to the following terms: +By submitting any Contribution to the Project, you agree to the following terms: -1. Definitions +--- -- "Contribution" means any source code, documentation, design, or other material submitted by you to the Project. +## 1. Definitions -- "Submit" means any form of electronic, written, or verbal communication intended to be included in the Project, including pull requests, patches, issues, or comments. +- **“Contribution”** means any source code, documentation, design, or other material submitted by you to the Project. +- **“Submit”** means any form of electronic, written, or verbal communication intended to be included in the Project, including but not limited to pull requests, patches, issues, or comments. -2. Copyright Ownership +--- -- You retain ownership of the copyright in your Contributions. +## 2. Copyright Ownership +- You retain ownership of the copyright in your Contributions. - Nothing in this Agreement transfers ownership of your intellectual property to the Company. -3. License Grant +--- + +## 3. License Grant + +You grant **Digital Fortress** a **perpetual, worldwide, non-exclusive, royalty-free, and irrevocable license** to: + +- Use +- Modify +- Distribute +- Re-license +- Sublicense +- Commercialize + +your Contributions as part of the Project or in any related products or services. + +This includes, but is not limited to, use in **proprietary**, **SaaS**, and **enterprise** offerings. + +--- + +## 4. Patent Grant -- You grant Digital Fortress a perpetual, worldwide, non-exclusive, royalty-free, irrevocable license to: - - Use - - Modify - - Distribute - - Re-license - - Sublicense - - Commercialize +You grant Digital Fortress a **perpetual, worldwide, royalty-free license** to any patent claims you own that are necessarily infringed by your Contributions. -- your Contributions as part of the Project or in any related products or services. +--- -- This includes use in proprietary, SaaS, and enterprise offerings. +## 5. Representations -4. Patent Grant +You represent and warrant that: -- You grant Digital Fortress a perpetual, worldwide, royalty-free license to any patent claims you own that are necessarily infringed by your Contributions. +- You have the legal right to submit the Contributions. +- The Contributions do not violate or infringe upon any third-party rights. +- If your employer or organization has intellectual property policies, you have obtained all necessary permissions to make the Contributions. -5. Representations +--- -- You represent that: - - You have the right to submit the Contributions - - The Contributions do not violate any third-party rights - - If your employer has IP policies, you have permission to contribute +## 6. No Obligation -6. No Obligation +The Company is **not obligated** to: -- The Company is not obligated to: +- Accept your Contributions. +- Provide any form of compensation. +- Include your Contributions in any release or distribution. -- Accept your Contributions +--- -- Provide compensation +## 7. Public Attribution -- Include your Contributions in any release +The Company **may**, but is not required to, publicly acknowledge or attribute your Contributions. -7. Public Attribution +--- -- The Company may publicly acknowledge your Contributions, but is not required to do so. +## 8. License Compatibility -8. License Compatibility +- Your Contributions will be licensed to users under the Project’s open-source license (e.g., **Apache License 2.0**). +- This Agreement governs only the relationship between you and the Company and does not modify the Project’s open-source license. -- Your Contributions will be licensed to users under the Project's open-source license (e.g., Apache License 2.0). +--- -- This CLA only governs the relationship between you and the Company. +## 9. Governing Law -9. Governing Law +This Agreement shall be governed by and construed in accordance with the laws of **Vietnam**. -- This Agreement is governed by the laws of Vietnam. +--- -- By submitting a Contribution, you confirm that you have read and agree to this Agreement. \ No newline at end of file +By submitting a Contribution, you confirm that you have read, understood, and agree to the terms of this Agreement. diff --git a/Dockerfile b/Dockerfile index 365966f..21a0d7c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,21 +1,23 @@ FROM python:3.10-alpine -ENV PYTHONUNBUFFERED=1 -RUN apk add build-base libffi-dev curl -# Allows docker to cache installed dependencies between builds -COPY ./dashboard-service/requirements.txt requirements.txt -RUN pip install -r requirements.txt -COPY ./django-common-utils django-common-utils -RUN pip install ../django-common-utils +ENV PYTHONUNBUFFERED=1 +ENV DJANGO_SETTINGS_MODULE="dashboard_service.settings" -# Adds our application code to the image -COPY ./dashboard-service dashboard-service +RUN apk add --no-cache \ + build-base \ + libffi-dev \ + curl \ + git -WORKDIR /dashboard-service +# Install private repo using BuildKit secret +RUN --mount=type=secret,id=github_token \ + pip install --no-cache-dir \ + git+https://$(cat /run/secrets/github_token)@github.com/Space-DF/django-common-utils.git@dev -EXPOSE 80 +WORKDIR /app -ENV DJANGO_SETTINGS_MODULE="dashboard_service.settings" +COPY . . +RUN pip install -r ./requirements.txt RUN ["chmod", "+x", "./docker-entrypoint.sh"]