libretime/.github/workflows/tools.yml

94 lines
2.5 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: ubuntu
release: focal
- 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 }} \
analyzer \
playout \
> 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 && \
DEBIAN_FRONTEND=noninteractive apt-get install -y software-properties-common && \
add-apt-repository -y ppa:libretime/libretime
EOF
cat <<EOF >> Dockerfile
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get -y install \
python3 \
python3-pip \
sudo \
$(cat packages.list)
ARG USER=docker
ARG UID=1000
ARG GID=1000
RUN adduser --disabled-password --uid=${UID} --gecos '' ${USER} && \
adduser ${USER} sudo && \
echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
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 }}