sintonia/.github/workflows/tools.yml

88 lines
2.3 KiB
YAML

name: Tools
on:
schedule:
- cron: "0 3 * * 0"
push:
branches: [master]
paths:
- "**/packages.ini"
- ".github/workflows/tools.yml"
jobs:
docker-dev-image:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- distribution: ubuntu
release: bionic
- distribution: debian
release: buster
- distribution: debian
release: bullseye
env:
REGISTRY: ghcr.io
IMAGE_ORG: libretime
IMAGE_NAME: libretime-dev
# See https://github.com/LibreTime/libretime/issues/1216
# See https://github.com/LibreTime/libretime/actions/runs/1190504235
if: ${{ github.repository_owner == 'LibreTime' }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Login to the Container registry
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Generate packages list
run: |
tools/packages.py --dev --format line ${{ matrix.release }} \
python_apps/airtime_analyzer \
python_apps/pypo \
> packages.list
- name: Generate Dockerfile
run: |
cat <<EOF >> Dockerfile
FROM ${{ matrix.distribution }}:${{ matrix.release }}
COPY packages.list packages.list
EOF
[[ "${{ matrix.release }}" == "bionic" ]] && \
cat <<EOF >> Dockerfile
RUN apt-get update && \
apt-get install -y software-properties-common && \
add-apt-repository -y ppa:libretime/libretime
EOF
cat <<EOF >> Dockerfile
RUN apt-get update && \
apt-get -y install \
python3 \
python3-pip \
$(cat packages.list)
ARG USER=docker
ARG UID=1000
ARG GID=1000
RUN useradd -m ${USER} --uid=${UID}
USER ${UID}:${GID}
WORKDIR /home/${USER}
EOF
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_ORG }}/${{ env.IMAGE_NAME }}:${{ matrix.release }}