Skip to content
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

build con pacchetti in sviluppo per demo #16

Merged
merged 9 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/build_development.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Build development image

on:
pull_request:
# Allow to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
build-image:
name: Build docker image
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2

- name: Login to Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Get the image id
id: get_image_id
run: |
IMAGE_ID=$(echo ghcr.io/${{ github.repository }} | tr '[A-Z]' '[a-z]')
echo ::set-output name=IMAGE_ID::$IMAGE_ID

- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch

- name: Build and push container image
uses: docker/build-push-action@v3
with:
context: .
file: ./Dockerfile.development
push: true
tags: ${{ steps.get_image_id.outputs.IMAGE_ID }}:${{ steps.extract_branch.outputs.branch }}_development
platforms: linux/amd64,linux/arm64
12 changes: 12 additions & 0 deletions Dockerfile.development
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM plone/plone-backend:6.0.4
COPY docker/create-constraints.py docker/constraints.cfg docker/requirements.txt requirements-development.txt mx.ini /app/


COPY versions.cfg /

RUN pip install -r https://dist.plone.org/release/6.0.4/requirements.txt ${PIP_PARAMS} && \
python create-constraints.py constraints.cfg constraints.txt && \
./bin/pip install mxdev && \
./bin/mxdev -c mx.ini && \
./bin/pip install --ignore-requires-python -r requirements-mxdev.txt ${PIP_PARAMS} && \
find /app/lib -name LC_MESSAGES -exec chown -R plone:plone {} \;
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,20 @@ Dal branch __main__ e dai tag vengono create automaticamente immagini Docker lin

https://github.com/RedTurtle/iocomune-backend/pkgs/container/iocomune-backend

## Immagini di sviluppo

E' possibile generare delle immagini per demo con pacchetti in sviluppo non ancora rilasciati.

Per fare questo, basta creare un branch e modificare il file mx.ini (file di configurazione per [mxdev](https://pypi.org/project/mxdev)).
mamico marked this conversation as resolved.
Show resolved Hide resolved

Nel file si possono impostare versioni custom e anche attivare pacchetti in sviluppo.

Non viene generata in automatico l'immagine (per evitare build inutili).
Per far partire una nuova build, basta far partire l'azione manualmente: https://github.com/RedTurtle/iocomune-backend/actions

Verrà creata un'immagine chiamata `nome_del_branch_development` (dove nome_del_branch è il nome del branch ovviamente) su https://ghcr.io/redturtle/iocomune-backend


# Quando fare un nuovo tag

Quando si devono fare degli aggiornamenti in produzione, e tutto è pronto e testato, allora si può fare un nuovo tag per fissarle.
Expand All @@ -63,4 +77,4 @@ Esempio di comando per il tag:
git tag -a 20211126-01 -m "versioni congelate al 2021-11-26"
```

Con il tag viene triggerata una pipeline all'interno di questo repo gitlab: https://gitlab.com/redturtle/io-comune/dist.backend.iocittadino, che aggiorna gli altri siti di test
Con il tag viene triggerata una pipeline all'interno di questo repo gitlab: https://gitlab.com/redturtle/io-comune/dist.backend.iocittadino, che aggiorna gli altri siti di test
11 changes: 11 additions & 0 deletions mx.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[settings]
requirements-in = requirements-development.txt
requirements-out = requirements-mxdev.txt
contraints-out = constraints-mxdev.txt

# custom variables
github = https://github.com

[design.plone.contenttypes]
url = ${settings:github}/RedTurtle/design.plone.contenttypes.git
branch = cekk_check_views
2 changes: 2 additions & 0 deletions requirements-development.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-r requirements.txt
-c constraints.txt
Loading