From 8f5b0178572a10077f6c51d18f14fc64bd4cc337 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Sun, 1 May 2022 21:51:57 +0200 Subject: [PATCH 1/6] dont build arm --- .github/workflows/docker-publish-latest.yml | 1 + .github/workflows/docker-publish-release.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/docker-publish-latest.yml b/.github/workflows/docker-publish-latest.yml index 07ab1869..e48bb307 100644 --- a/.github/workflows/docker-publish-latest.yml +++ b/.github/workflows/docker-publish-latest.yml @@ -38,6 +38,7 @@ jobs: with: publish: true imageName: vabene1111/recipes + platform: linux/amd64,linux/arm64 tag: latest dockerUser: ${{ secrets.DOCKER_USERNAME }} dockerPassword: ${{ secrets.DOCKER_PASSWORD }} diff --git a/.github/workflows/docker-publish-release.yml b/.github/workflows/docker-publish-release.yml index 636ed576..1b79b34d 100644 --- a/.github/workflows/docker-publish-release.yml +++ b/.github/workflows/docker-publish-release.yml @@ -40,6 +40,7 @@ jobs: with: publish: true imageName: vabene1111/recipes + platform: linux/amd64,linux/arm64 tag: ${{ steps.get_version.outputs.VERSION }} dockerUser: ${{ secrets.DOCKER_USERNAME }} dockerPassword: ${{ secrets.DOCKER_PASSWORD }} From df2f1b2b7ccbae23ecccc5a2fd1530e502599351 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Wed, 4 May 2022 17:18:25 +0200 Subject: [PATCH 2/6] testing armv7 build solutuin taken from https://github.com/healthchecks/healthchecks/issues/568#issuecomment-942047344 --- Dockerfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Dockerfile b/Dockerfile index 6f220136..f993e655 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,6 +15,11 @@ WORKDIR /opt/recipes COPY requirements.txt ./ +RUN \ + if [ `dpkg --print-architecture` = "armhf" ]; then \ + printf "[global]\nextra-index-url=https://www.piwheels.org/simple\n" > /etc/pip.conf ; \ + fi + RUN apk add --no-cache --virtual .build-deps gcc musl-dev postgresql-dev zlib-dev jpeg-dev libwebp-dev libressl-dev libffi-dev cargo openssl-dev openldap-dev python3-dev && \ echo -n "INPUT ( libldap.so )" > /usr/lib/libldap_r.so && \ python -m venv venv && \ From cb248a1f197c6342de0c2fb3a44ce82e14a8f876 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Wed, 4 May 2022 20:33:10 +0200 Subject: [PATCH 3/6] beta build test libressl --- Dockerfile | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index f993e655..53702bf4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,12 +15,7 @@ WORKDIR /opt/recipes COPY requirements.txt ./ -RUN \ - if [ `dpkg --print-architecture` = "armhf" ]; then \ - printf "[global]\nextra-index-url=https://www.piwheels.org/simple\n" > /etc/pip.conf ; \ - fi - -RUN apk add --no-cache --virtual .build-deps gcc musl-dev postgresql-dev zlib-dev jpeg-dev libwebp-dev libressl-dev libffi-dev cargo openssl-dev openldap-dev python3-dev && \ +RUN apk add --no-cache --virtual .build-deps gcc musl-dev postgresql-dev zlib-dev jpeg-dev libwebp-dev libressl-dev libffi-dev cargo openldap-dev python3-dev && \ echo -n "INPUT ( libldap.so )" > /usr/lib/libldap_r.so && \ python -m venv venv && \ /opt/recipes/venv/bin/python -m pip install --upgrade pip && \ From de196c716b1b87a722e3f46c333c340870046304 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Wed, 4 May 2022 20:33:27 +0200 Subject: [PATCH 4/6] build test openssl --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 53702bf4..c43f7fb0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,7 +15,7 @@ WORKDIR /opt/recipes COPY requirements.txt ./ -RUN apk add --no-cache --virtual .build-deps gcc musl-dev postgresql-dev zlib-dev jpeg-dev libwebp-dev libressl-dev libffi-dev cargo openldap-dev python3-dev && \ +RUN apk add --no-cache --virtual .build-deps gcc musl-dev postgresql-dev zlib-dev jpeg-dev libwebp-dev openssl-dev libffi-dev cargo openldap-dev python3-dev && \ echo -n "INPUT ( libldap.so )" > /usr/lib/libldap_r.so && \ python -m venv venv && \ /opt/recipes/venv/bin/python -m pip install --upgrade pip && \ From 330bb6d95430d2395c36297f5c4ce4ffa00fc9d7 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Fri, 6 May 2022 15:07:54 +0200 Subject: [PATCH 5/6] testing extra raspi build --- .../workflows/docker-publish-latest-raspi.yml | 45 ++++++++++++++++ .../docker-publish-release-raspi.yml | 54 +++++++++++++++++++ Dockerfile-raspi | 36 +++++++++++++ 3 files changed, 135 insertions(+) create mode 100644 .github/workflows/docker-publish-latest-raspi.yml create mode 100644 .github/workflows/docker-publish-release-raspi.yml create mode 100644 Dockerfile-raspi diff --git a/.github/workflows/docker-publish-latest-raspi.yml b/.github/workflows/docker-publish-latest-raspi.yml new file mode 100644 index 00000000..69e9f424 --- /dev/null +++ b/.github/workflows/docker-publish-latest-raspi.yml @@ -0,0 +1,45 @@ +name: publish latest image docker +on: + push: + tags: + - '*' + +jobs: + build: + if: github.repository_owner == 'TandoorRecipes' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - name: Get version number + id: get_version + run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}-raspi + # Update Version number + - name: Update version file + uses: DamianReeves/write-file-action@v1.0 + with: + path: recipes/version.py + contents: | + VERSION_NUMBER = '${{ steps.get_version.outputs.VERSION }}-raspi' + BUILD_REF = '${{ github.sha }}' + write-mode: overwrite + # Build Vue frontend + - uses: actions/setup-node@v2 + with: + node-version: '14' + - name: Install dependencies + working-directory: ./vue + run: yarn install + - name: Build dependencies + working-directory: ./vue + run: yarn build + # Build container + - name: Build and publish image + uses: ilteoood/docker_buildx@master + with: + publish: true + imageName: vabene1111/recipes + dockerFile: Dockerfile-raspi + platform: linux/arm/v7 + tag: latest-raspi + dockerUser: ${{ secrets.DOCKER_USERNAME }} + dockerPassword: ${{ secrets.DOCKER_PASSWORD }} diff --git a/.github/workflows/docker-publish-release-raspi.yml b/.github/workflows/docker-publish-release-raspi.yml new file mode 100644 index 00000000..d5e564ac --- /dev/null +++ b/.github/workflows/docker-publish-release-raspi.yml @@ -0,0 +1,54 @@ +name: publish tagged release docker + +on: + release: + types: [published] + +jobs: + build: + if: github.repository_owner == 'TandoorRecipes' + runs-on: ubuntu-latest + name: Build image job + steps: + - name: Checkout master + uses: actions/checkout@master + - name: Get version number + id: get_version + run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} + # Update Version number + - name: Update version file + uses: DamianReeves/write-file-action@v1.0 + with: + path: recipes/version.py + contents: | + VERSION_NUMBER = '${{ steps.get_version.outputs.VERSION }}' + BUILD_REF = '${{ github.sha }}' + write-mode: overwrite + # Build Vue frontend + - uses: actions/setup-node@v2 + with: + node-version: '14' + - name: Install dependencies + working-directory: ./vue + run: yarn install + - name: Build dependencies + working-directory: ./vue + run: yarn build + # Build container + - name: Build and publish image + uses: ilteoood/docker_buildx@master + with: + publish: true + imageName: vabene1111/recipes + dockerFile: Dockerfile-raspi + platform: linux/arm/v7 + tag: ${{ steps.get_version.outputs.VERSION }}-raspi + dockerUser: ${{ secrets.DOCKER_USERNAME }} + dockerPassword: ${{ secrets.DOCKER_PASSWORD }} + # Send discord notification + - name: Discord notification + env: + DISCORD_WEBHOOK: ${{ secrets.DISCORD_RELEASE_WEBHOOK }} + uses: Ilshidur/action-discord@0.3.2 + with: + args: '🚀 Version {{ EVENT_PAYLOAD.release.tag_name }} of tandoor has been released 🥳 Check it out https://github.com/vabene1111/recipes/releases/tag/{{ EVENT_PAYLOAD.release.tag_name }}' diff --git a/Dockerfile-raspi b/Dockerfile-raspi new file mode 100644 index 00000000..b1b57757 --- /dev/null +++ b/Dockerfile-raspi @@ -0,0 +1,36 @@ +# builds of cryptography for raspberry pi (or better arm v7) fail for some +FROM python:3.9-alpine3.15 + +#Install all dependencies. +RUN apk add --no-cache postgresql-libs postgresql-client gettext zlib libjpeg libwebp libxml2-dev libxslt-dev py-cryptography openldap + +#Print all logs without buffering it. +ENV PYTHONUNBUFFERED 1 + +#This port will be used by gunicorn. +EXPOSE 8080 + +#Create app dir and install requirements. +RUN mkdir /opt/recipes +WORKDIR /opt/recipes + +COPY requirements.txt ./ + +RUN \ + if [ `apk --print-arch` = "armv7" ]; then \ + printf "[global]\nextra-index-url=https://www.piwheels.org/simple\n" > /etc/pip.conf ; \ + fi + +RUN apk add --no-cache --virtual .build-deps gcc musl-dev postgresql-dev zlib-dev jpeg-dev libwebp-dev openssl-dev libffi-dev cargo openldap-dev python3-dev && \ + echo -n "INPUT ( libldap.so )" > /usr/lib/libldap_r.so && \ + python -m venv venv && \ + /opt/recipes/venv/bin/python -m pip install --upgrade pip && \ + venv/bin/pip install wheel==0.37.1 && \ + venv/bin/pip install setuptools_rust==1.1.2 && \ + venv/bin/pip install -r requirements.txt --no-cache-dir &&\ + apk --purge del .build-deps + +#Copy project and execute it. +COPY . ./ +RUN chmod +x boot.sh +ENTRYPOINT ["/opt/recipes/boot.sh"] From eab59fcbd81df559b436a37f2d738b163634a620 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Fri, 6 May 2022 16:08:13 +0200 Subject: [PATCH 6/6] Update docker-publish-latest-raspi.yml --- .github/workflows/docker-publish-latest-raspi.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-publish-latest-raspi.yml b/.github/workflows/docker-publish-latest-raspi.yml index 69e9f424..d1d339b1 100644 --- a/.github/workflows/docker-publish-latest-raspi.yml +++ b/.github/workflows/docker-publish-latest-raspi.yml @@ -1,8 +1,8 @@ name: publish latest image docker on: push: - tags: - - '*' + branches: + - 'beta' jobs: build: