Merge pull request #5 from derogab/dev

Use Alpine as docker base image
This commit is contained in:
Gabriele De Rosa 2021-11-26 16:03:40 +01:00 committed by GitHub
commit cdc0f990b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 47 additions and 24 deletions

View File

@ -98,7 +98,7 @@ jobs:
uses: docker/build-push-action@v2 uses: docker/build-push-action@v2
with: with:
context: . 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' }} push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
@ -155,7 +155,7 @@ jobs:
uses: docker/build-push-action@v2 uses: docker/build-push-action@v2
with: with:
context: . 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' }} push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}

View File

@ -1,26 +1,38 @@
FROM python:3 FROM alpine:3.14
# Set working space # Set working space
WORKDIR /usr/src/app WORKDIR /usr/src/app
# Install dependencies # Install dependencies
RUN apt-get update \ RUN apk update --no-cache \
# Prevent endless waiting # Install packages
&& DEBIAN_FRONTEND=noninteractive \ && apk add --no-cache \
tzdata \
python3 py3-pip py3-numpy py3-pandas py3-matplotlib \
ttf-liberation qt5-qtwebkit wkhtmltopdf \
# Set UTC as timezone # Set UTC as timezone
&& ln -snf /usr/share/zoneinfo/Europe/Rome /etc/localtime \ && ln -snf /usr/share/zoneinfo/Europe/Rome /etc/localtime \
# Install APT packages
&& apt-get install -y --fix-missing wkhtmltopdf \
# Remove tmp files # 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 # Upgrade PIP
&& python3 -m pip install --no-cache-dir --upgrade pip && python3 -m pip install --no-cache-dir --upgrade pip
# Copy and install requirements # Copy PIP extra index URLs
COPY pip.conf .
# Copy requirements
COPY requirements.txt . COPY requirements.txt .
RUN python3 -m pip install -r requirements.txt
# Install requirements
RUN apk update --no-cache \
# Install tmp packages
&& 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
&& python3 -m pip install --no-cache-dir -r requirements.txt \
# Delete tmp packages
&& apk del build-deps
# Copy app # Copy app
COPY . . COPY . .

View File

@ -1,23 +1,29 @@
<h1 align="center">:it: ITA vs. COVID :microbe:</h1>
<p align="center">
<img src="./assets/images/logo.png" alt="header" width="150px">
</p>
<h3 align="center">Un bot telegram che ti aggiorna sulla battaglia contro il Covid in Italia</h3>
<p align="center">
<a href="https://hub.docker.com/r/derogab/itavscovidbot">
<img src="https://img.shields.io/docker/pulls/derogab/itavscovidbot?label=Downloads&logo=docker" alt="Docker Pulls">
</a>
<a href="https://github.com/derogab/itavscovidbot/actions/workflows/docker-publish.yml">
<img src="https://github.com/derogab/itavscovidbot/actions/workflows/docker-publish.yml/badge.svg" alt="Build & Push Docker Image">
</a>
</p>
<div align="center"> ## Configurazione
<img src="./assets/images/logo.png" width="150">
</div>
<div align="center">
<h1 align="center">🇮🇹 ITA vs. COVID 🦠</h1>
Un bot telegram che ti aggiorna sulla battaglia contro il Covid in Italia.
</div>
### Configurazione
Copia tutti i file `.env.sample` nei relativi `.env` con le preferenze personali. 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). Il bot utilizza [docker](https://www.docker.com/) e [docker-compose](https://docs.docker.com/compose).
``` ```
docker-compose up --build docker-compose up --build
``` ```
### Crediti ## Crediti
Il bot è stato sviluppato da [@derogab](https://github.com/derogab) e il codice sorgente è pubblicamente disponibile su Github. Il bot è stato sviluppato da [@derogab](https://github.com/derogab) e il codice sorgente è pubblicamente disponibile su Github.

5
pip.conf Normal file
View File

@ -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