diff --git a/.github/workflows/docker-publish-latest-raspi.yml b/.github/workflows/docker-publish-latest-raspi.yml new file mode 100644 index 00000000..d1d339b1 --- /dev/null +++ b/.github/workflows/docker-publish-latest-raspi.yml @@ -0,0 +1,45 @@ +name: publish latest image docker +on: + push: + branches: + - 'beta' + +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-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-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/.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 }} diff --git a/Dockerfile b/Dockerfile index 6f220136..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 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 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 && \ 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"]