From a336ea0ffa2aa1c02372bef546c9e99aa8dd8fa3 Mon Sep 17 00:00:00 2001 From: Gabriele De Rosa <4183824+derogab@users.noreply.github.com> Date: Tue, 26 Oct 2021 14:16:43 +0200 Subject: [PATCH 01/19] Use slim python base --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index d1db82b..f93e831 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3 +FROM python:3-slim # Set working space WORKDIR /usr/src/app From b468bf8572755bb4f5373b30cf958f71474e2423 Mon Sep 17 00:00:00 2001 From: Gabriele De Rosa <4183824+derogab@users.noreply.github.com> Date: Tue, 26 Oct 2021 14:22:26 +0200 Subject: [PATCH 02/19] Use alpine python base --- Dockerfile | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index f93e831..3aae441 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,18 +1,16 @@ -FROM python:3-slim +FROM python:3-alpine # Set working space WORKDIR /usr/src/app # Install dependencies -RUN apt-get update \ - # Prevent endless waiting - && DEBIAN_FRONTEND=noninteractive \ +RUN apk update \ # Set UTC as timezone && ln -snf /usr/share/zoneinfo/Europe/Rome /etc/localtime \ # Install APT packages - && apt-get install -y --fix-missing wkhtmltopdf \ + && apk add gcc build-base freetype-dev libpng-dev openblas-dev wkhtmltopdf \ # Remove tmp files - && apt-get clean && rm -rf /tmp/* /var/tmp/* \ + && rm -rf /tmp/* /var/tmp/* \ # Add PiWheels support && echo "[global]\nextra-index-url=https://www.piwheels.org/simple" >> /etc/pip.conf \ # Upgrade PIP @@ -20,7 +18,7 @@ RUN apt-get update \ # Copy and install requirements COPY requirements.txt . -RUN python3 -m pip install -r requirements.txt +RUN python3 -m pip install --no-cache-dir -r requirements.txt # Copy app COPY . . From b73cde8cd551176d186ca0f50418e1eefb04a4fb Mon Sep 17 00:00:00 2001 From: Gabriele De Rosa <4183824+derogab@users.noreply.github.com> Date: Tue, 26 Oct 2021 15:04:38 +0200 Subject: [PATCH 03/19] Add some requirements with APK --- Dockerfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 3aae441..cc9eea5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,10 @@ RUN apk update \ # Set UTC as timezone && ln -snf /usr/share/zoneinfo/Europe/Rome /etc/localtime \ # Install APT packages - && apk add gcc build-base freetype-dev libpng-dev openblas-dev wkhtmltopdf \ + && apk add \ + gcc build-base freetype-dev libpng-dev openblas-dev \ + py3-numpy py3-pandas py3-pillow py3-matplotlib \ + wkhtmltopdf \ # Remove tmp files && rm -rf /tmp/* /var/tmp/* \ # Add PiWheels support From f8c09f7eb7254bc1b9112a23fb1a2fca0d03f567 Mon Sep 17 00:00:00 2001 From: Gabriele De Rosa <4183824+derogab@users.noreply.github.com> Date: Tue, 26 Oct 2021 17:41:46 +0200 Subject: [PATCH 04/19] Fix --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index cc9eea5..e95a60f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,7 @@ RUN apk update \ # Install APT packages && apk add \ gcc build-base freetype-dev libpng-dev openblas-dev \ - py3-numpy py3-pandas py3-pillow py3-matplotlib \ + py3-numpy py3-pandas py3-matplotlib \ wkhtmltopdf \ # Remove tmp files && rm -rf /tmp/* /var/tmp/* \ From 2cdaf9199e0c682613c7f206840de9243defcb0c Mon Sep 17 00:00:00 2001 From: Gabriele De Rosa <4183824+derogab@users.noreply.github.com> Date: Sun, 31 Oct 2021 02:38:23 +0200 Subject: [PATCH 05/19] Add cmake --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index e95a60f..1ba8131 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,7 @@ RUN apk update \ && ln -snf /usr/share/zoneinfo/Europe/Rome /etc/localtime \ # Install APT packages && apk add \ - gcc build-base freetype-dev libpng-dev openblas-dev \ + gcc cmake build-base freetype-dev libpng-dev openblas-dev \ py3-numpy py3-pandas py3-matplotlib \ wkhtmltopdf \ # Remove tmp files From c08169e987512c0f14b145050db9cd756200e88d Mon Sep 17 00:00:00 2001 From: Gabriele De Rosa <4183824+derogab@users.noreply.github.com> Date: Sun, 31 Oct 2021 02:37:45 +0100 Subject: [PATCH 06/19] Use alpine:latest --- Dockerfile | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1ba8131..76f68ba 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3-alpine +FROM alpine:latest # Set working space WORKDIR /usr/src/app @@ -7,10 +7,10 @@ WORKDIR /usr/src/app RUN apk update \ # Set UTC as timezone && ln -snf /usr/share/zoneinfo/Europe/Rome /etc/localtime \ - # Install APT packages + # Install packages && apk add \ - gcc cmake build-base freetype-dev libpng-dev openblas-dev \ - py3-numpy py3-pandas py3-matplotlib \ + build-base freetype-dev libpng-dev openblas-dev \ + python3 py3-numpy py3-pandas py3-matplotlib \ wkhtmltopdf \ # Remove tmp files && rm -rf /tmp/* /var/tmp/* \ @@ -19,9 +19,17 @@ RUN apk update \ # Upgrade PIP && python3 -m pip install --no-cache-dir --upgrade pip -# Copy and install requirements +# Copy requirements COPY requirements.txt . -RUN python3 -m pip install --no-cache-dir -r requirements.txt + +# Install requirements +RUN apk update \ + # Install tmp packages + && apk add --virtual build-deps gcc python3-dev musl-dev \ + # Install PIP packages + && python3 -m pip install --no-cache-dir -r requirements.txt \ + # Delete tmp packages + && apk del build-deps # Copy app COPY . . From 33326e3a5b0afc016a65b178c1e98e11ebb61594 Mon Sep 17 00:00:00 2001 From: Gabriele De Rosa <4183824+derogab@users.noreply.github.com> Date: Sun, 31 Oct 2021 02:40:06 +0100 Subject: [PATCH 07/19] Install PIP --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 76f68ba..536657b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,7 @@ RUN apk update \ # Install packages && apk add \ build-base freetype-dev libpng-dev openblas-dev \ - python3 py3-numpy py3-pandas py3-matplotlib \ + python3 py3-pip py3-numpy py3-pandas py3-matplotlib \ wkhtmltopdf \ # Remove tmp files && rm -rf /tmp/* /var/tmp/* \ From 857d89d26a98463a08a636fd5c7f70beff7a7168 Mon Sep 17 00:00:00 2001 From: Gabriele De Rosa <4183824+derogab@users.noreply.github.com> Date: Sun, 31 Oct 2021 02:48:30 +0100 Subject: [PATCH 08/19] Add tzdata --- Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 536657b..d134e23 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,13 +5,14 @@ WORKDIR /usr/src/app # Install dependencies RUN apk update \ - # Set UTC as timezone - && ln -snf /usr/share/zoneinfo/Europe/Rome /etc/localtime \ # Install packages && apk add \ + tzdata \ build-base freetype-dev libpng-dev openblas-dev \ python3 py3-pip py3-numpy py3-pandas py3-matplotlib \ wkhtmltopdf \ + # Set UTC as timezone + && ln -snf /usr/share/zoneinfo/Europe/Rome /etc/localtime \ # Remove tmp files && rm -rf /tmp/* /var/tmp/* \ # Add PiWheels support From 22da4ff0eaf2b0878b8ecb8b0cdb4440d739d362 Mon Sep 17 00:00:00 2001 From: Gabriele De Rosa <4183824+derogab@users.noreply.github.com> Date: Sun, 31 Oct 2021 02:54:05 +0100 Subject: [PATCH 09/19] Remove linux/arm/v6 architecture in docker images --- .github/workflows/docker-publish.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 25bb8c6..9f795b9 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -98,7 +98,7 @@ jobs: uses: docker/build-push-action@v2 with: context: . - platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 + platforms: linux/amd64,linux/arm64,linux/arm/v7 push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} @@ -155,7 +155,7 @@ jobs: uses: docker/build-push-action@v2 with: context: . - platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 + platforms: linux/amd64,linux/arm64,linux/arm/v7 push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file From ffc7c783157f8e55c717c75143b203a92298ea00 Mon Sep 17 00:00:00 2001 From: Gabriele De Rosa <4183824+derogab@users.noreply.github.com> Date: Fri, 26 Nov 2021 01:40:08 +0100 Subject: [PATCH 10/19] Update README.md --- README.md | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index fcfb27d..19ccc69 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,29 @@ +

:it: ITA vs. COVID :microbe:

+

+ header +

+

Un bot telegram che ti aggiorna sulla battaglia contro il Covid in Italia

+

+ + Docker Pulls + + + Build & Push Docker Image + +

+ -
- -
-
-

🇮🇹 ITA vs. COVID 🦠

- Un bot telegram che ti aggiorna sulla battaglia contro il Covid in Italia. -
- -### Configurazione +## Configurazione Copia tutti i file `.env.sample` nei relativi `.env` con le preferenze personali. -### Avvio +## Avvio Il bot utilizza [docker](https://www.docker.com/) e [docker-compose](https://docs.docker.com/compose). ``` docker-compose up --build ``` -### Crediti +## Crediti Il bot è stato sviluppato da [@derogab](https://github.com/derogab) e il codice sorgente è pubblicamente disponibile su Github. From f43e4c38dadf4602851f117a843d7d0a3918e399 Mon Sep 17 00:00:00 2001 From: Gabriele De Rosa <4183824+derogab@users.noreply.github.com> Date: Fri, 26 Nov 2021 01:54:34 +0100 Subject: [PATCH 11/19] Use SLIM version of Python as docker base image --- Dockerfile | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/Dockerfile b/Dockerfile index d134e23..f93e831 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,36 +1,26 @@ -FROM alpine:latest +FROM python:3-slim # Set working space WORKDIR /usr/src/app # Install dependencies -RUN apk update \ - # Install packages - && apk add \ - tzdata \ - build-base freetype-dev libpng-dev openblas-dev \ - python3 py3-pip py3-numpy py3-pandas py3-matplotlib \ - wkhtmltopdf \ +RUN apt-get update \ + # Prevent endless waiting + && DEBIAN_FRONTEND=noninteractive \ # Set UTC as timezone && ln -snf /usr/share/zoneinfo/Europe/Rome /etc/localtime \ + # Install APT packages + && apt-get install -y --fix-missing wkhtmltopdf \ # Remove tmp files - && rm -rf /tmp/* /var/tmp/* \ + && apt-get clean && rm -rf /tmp/* /var/tmp/* \ # Add PiWheels support && echo "[global]\nextra-index-url=https://www.piwheels.org/simple" >> /etc/pip.conf \ # Upgrade PIP && python3 -m pip install --no-cache-dir --upgrade pip -# Copy requirements +# Copy and install requirements COPY requirements.txt . - -# Install requirements -RUN apk update \ - # Install tmp packages - && apk add --virtual build-deps gcc python3-dev musl-dev \ - # Install PIP packages - && python3 -m pip install --no-cache-dir -r requirements.txt \ - # Delete tmp packages - && apk del build-deps +RUN python3 -m pip install -r requirements.txt # Copy app COPY . . From 30f1023f6c0474cc6b6d07a7a9fba5291453c9e7 Mon Sep 17 00:00:00 2001 From: Gabriele De Rosa <4183824+derogab@users.noreply.github.com> Date: Fri, 26 Nov 2021 02:11:50 +0100 Subject: [PATCH 12/19] Fix requirements Install gfortran --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index f93e831..e09ca76 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,7 @@ RUN apt-get update \ # Set UTC as timezone && ln -snf /usr/share/zoneinfo/Europe/Rome /etc/localtime \ # Install APT packages - && apt-get install -y --fix-missing wkhtmltopdf \ + && apt-get install -y --fix-missing wkhtmltopdf gfortran \ # Remove tmp files && apt-get clean && rm -rf /tmp/* /var/tmp/* \ # Add PiWheels support From 487d77e90eb730d9b765b3a6348482a823cbc476 Mon Sep 17 00:00:00 2001 From: Gabriele De Rosa <4183824+derogab@users.noreply.github.com> Date: Fri, 26 Nov 2021 12:11:50 +0100 Subject: [PATCH 13/19] Use ALPINE version of Python as docker base image --- Dockerfile | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index e09ca76..d134e23 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,26 +1,36 @@ -FROM python:3-slim +FROM alpine:latest # Set working space WORKDIR /usr/src/app # Install dependencies -RUN apt-get update \ - # Prevent endless waiting - && DEBIAN_FRONTEND=noninteractive \ +RUN apk update \ + # Install packages + && apk add \ + tzdata \ + build-base freetype-dev libpng-dev openblas-dev \ + python3 py3-pip py3-numpy py3-pandas py3-matplotlib \ + wkhtmltopdf \ # Set UTC as timezone && ln -snf /usr/share/zoneinfo/Europe/Rome /etc/localtime \ - # Install APT packages - && apt-get install -y --fix-missing wkhtmltopdf gfortran \ # Remove tmp files - && apt-get clean && rm -rf /tmp/* /var/tmp/* \ + && rm -rf /tmp/* /var/tmp/* \ # Add PiWheels support && echo "[global]\nextra-index-url=https://www.piwheels.org/simple" >> /etc/pip.conf \ # Upgrade PIP && python3 -m pip install --no-cache-dir --upgrade pip -# Copy and install requirements +# Copy requirements COPY requirements.txt . -RUN python3 -m pip install -r requirements.txt + +# Install requirements +RUN apk update \ + # Install tmp packages + && apk add --virtual build-deps gcc python3-dev musl-dev \ + # Install PIP packages + && python3 -m pip install --no-cache-dir -r requirements.txt \ + # Delete tmp packages + && apk del build-deps # Copy app COPY . . From 6352e9df702d08ecc4c29a1d06f0d5708d523f7e Mon Sep 17 00:00:00 2001 From: Gabriele De Rosa <4183824+derogab@users.noreply.github.com> Date: Fri, 26 Nov 2021 12:16:43 +0100 Subject: [PATCH 14/19] Add --no-cache flag --- Dockerfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index d134e23..d69e2df 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,9 +4,9 @@ FROM alpine:latest WORKDIR /usr/src/app # Install dependencies -RUN apk update \ +RUN apk update --no-cache \ # Install packages - && apk add \ + && apk add --no-cache \ tzdata \ build-base freetype-dev libpng-dev openblas-dev \ python3 py3-pip py3-numpy py3-pandas py3-matplotlib \ @@ -24,9 +24,9 @@ RUN apk update \ COPY requirements.txt . # Install requirements -RUN apk update \ +RUN apk update --no-cache \ # Install tmp packages - && apk add --virtual build-deps gcc python3-dev musl-dev \ + && apk add --no-cache --virtual build-deps gcc python3-dev musl-dev \ # Install PIP packages && python3 -m pip install --no-cache-dir -r requirements.txt \ # Delete tmp packages From b1ba5cf3f267d6f3c9f52715594ba8624bfb80a1 Mon Sep 17 00:00:00 2001 From: Gabriele De Rosa <4183824+derogab@users.noreply.github.com> Date: Fri, 26 Nov 2021 12:20:13 +0100 Subject: [PATCH 15/19] Use alpine 3.14 as docker base image --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index d69e2df..721ad91 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:latest +FROM alpine:3.14 # Set working space WORKDIR /usr/src/app From 35de8e84c68d8a9b82a03df4d6e403806497acca Mon Sep 17 00:00:00 2001 From: Gabriele De Rosa <4183824+derogab@users.noreply.github.com> Date: Fri, 26 Nov 2021 12:44:25 +0100 Subject: [PATCH 16/19] Add PIP extra index URLs --- Dockerfile | 7 +++++-- pip.conf | 5 +++++ 2 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 pip.conf diff --git a/Dockerfile b/Dockerfile index 721ad91..e9119ec 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,11 +15,12 @@ RUN apk update --no-cache \ && ln -snf /usr/share/zoneinfo/Europe/Rome /etc/localtime \ # Remove tmp files && rm -rf /tmp/* /var/tmp/* \ - # Add PiWheels support - && echo "[global]\nextra-index-url=https://www.piwheels.org/simple" >> /etc/pip.conf \ # Upgrade PIP && python3 -m pip install --no-cache-dir --upgrade pip +# Copy PIP extra index URLs +COPY pip.conf + # Copy requirements COPY requirements.txt . @@ -27,6 +28,8 @@ COPY requirements.txt . RUN apk update --no-cache \ # Install tmp packages && apk add --no-cache --virtual build-deps gcc python3-dev musl-dev \ + # Add PIP extra index URLs + && mv pip.conf /etc/pip.conf \ # Install PIP packages && python3 -m pip install --no-cache-dir -r requirements.txt \ # Delete tmp packages diff --git a/pip.conf b/pip.conf new file mode 100644 index 0000000..1e65546 --- /dev/null +++ b/pip.conf @@ -0,0 +1,5 @@ +[global] +index-url = https://alpine-wheels.github.io/index +extra-index-url = https://pypi.python.org/simple + https://pypi.org/simple + https://www.piwheels.org/simple From 6cbbd6d1b3a614d5d012d2e9bb50bdd16b4c720f Mon Sep 17 00:00:00 2001 From: Gabriele De Rosa <4183824+derogab@users.noreply.github.com> Date: Fri, 26 Nov 2021 12:45:25 +0100 Subject: [PATCH 17/19] Fix Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index e9119ec..3bae096 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,7 +19,7 @@ RUN apk update --no-cache \ && python3 -m pip install --no-cache-dir --upgrade pip # Copy PIP extra index URLs -COPY pip.conf +COPY pip.conf . # Copy requirements COPY requirements.txt . From f4caa7a9247c76f240d1f66e5513463d6a937779 Mon Sep 17 00:00:00 2001 From: Gabriele De Rosa <4183824+derogab@users.noreply.github.com> Date: Fri, 26 Nov 2021 12:54:06 +0100 Subject: [PATCH 18/19] Move some packages to tmp packages --- Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3bae096..1f1579a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,6 @@ RUN apk update --no-cache \ # Install packages && apk add --no-cache \ tzdata \ - build-base freetype-dev libpng-dev openblas-dev \ python3 py3-pip py3-numpy py3-pandas py3-matplotlib \ wkhtmltopdf \ # Set UTC as timezone @@ -27,7 +26,7 @@ COPY requirements.txt . # Install requirements RUN apk update --no-cache \ # Install tmp packages - && apk add --no-cache --virtual build-deps gcc python3-dev musl-dev \ + && apk add --no-cache --virtual build-deps gcc python3-dev musl-dev build-base freetype-dev libpng-dev openblas-dev \ # Add PIP extra index URLs && mv pip.conf /etc/pip.conf \ # Install PIP packages From 39fc0be13524d28925cd334bd1c96cb3c3085dd7 Mon Sep 17 00:00:00 2001 From: Gabriele De Rosa <4183824+derogab@users.noreply.github.com> Date: Fri, 26 Nov 2021 15:04:17 +0100 Subject: [PATCH 19/19] Add wkhtmltopdf requirements on Alpine - Install ttf-liberation - Install qt5-qtwebkit --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 1f1579a..157cf51 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,7 @@ RUN apk update --no-cache \ && apk add --no-cache \ tzdata \ python3 py3-pip py3-numpy py3-pandas py3-matplotlib \ - wkhtmltopdf \ + ttf-liberation qt5-qtwebkit wkhtmltopdf \ # Set UTC as timezone && ln -snf /usr/share/zoneinfo/Europe/Rome /etc/localtime \ # Remove tmp files