Skip to content

Build Docker images #712

Build Docker images

Build Docker images #712

Workflow file for this run

name: "Build Docker images"
on:
push:
branches:
- master
schedule:
- cron: "0 12 * * 0,2,4,6"
env:
PYTHON_3_8_IMAGE: "3.8.18"
PYTHON_3_8_TAGS: "3.8.18 3.8"
PYTHON_3_9_IMAGE: "3.9.18"
PYTHON_3_9_TAGS: "3.9.18 3.9"
PYTHON_3_10_IMAGE: "3.10.13"
PYTHON_3_10_TAGS: "3.10.13 3.10"
PYTHON_3_11_IMAGE: "3.11.8"
PYTHON_3_11_TAGS: "3.11.8 3.11"
PYTHON_3_12_IMAGE: "3.12.2"
PYTHON_3_12_TAGS: "3.12.2 3.12 ."
jobs:
setup:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.11
uses: actions/setup-python@v1
with:
python-version: '3.12'
- name: Ensure login succeeds for Docker Hub and GitHub registry
shell: bash
run: |
echo "${{ secrets.DOCKER_LOGIN_PASSWORD }}" | docker login --username "${{ secrets.DOCKER_LOGIN_USERNAME }}" --password-stdin
echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin
- name: Always regenerate dockerfiles folder
shell: bash
run: |
rm -rf dockerfiles
pip install -U pip
pip install -U -r requirements.txt
python generate.py
cd dockerfiles
find ./ -name "*.sh" -exec chmod +x {} \;
cd ..
- uses: actions/upload-artifact@v1
with:
name: dockerfiles
path: dockerfiles
minimal:
runs-on: ubuntu-latest
needs: setup
strategy:
max-parallel: 8
matrix:
python-version: [3_8, 3_9, 3_10, 3_11, 3_12]
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v1
with:
name: dockerfiles
- name: Build minimal containers
shell: bash
run: |
export GIT_HEAD="`git rev-list --count HEAD || echo unknown`+`git rev-parse --short HEAD || echo unknown`"
echo "${{ secrets.DOCKER_LOGIN_PASSWORD }}" | docker login --username "${{ secrets.DOCKER_LOGIN_USERNAME }}" --password-stdin
cd dockerfiles
find ./ -name "*.sh" -exec chmod +x {} \;
./deploy_target.sh 0_minimal ${PYTHON_${{ matrix.python-version }}_IMAGE}
cd ..
- uses: actions/upload-artifact@v1
with:
name: dockerfiles
path: dockerfiles
full:
runs-on: ubuntu-latest
needs: minimal
strategy:
max-parallel: 8
matrix:
python-version: [3_8, 3_9, 3_10, 3_11, 3_12]
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v1
with:
name: dockerfiles
- name: Build full containers
shell: bash
run: |
export GIT_HEAD="`git rev-list --count HEAD || echo unknown`+`git rev-parse --short HEAD || echo unknown`"
echo "${{ secrets.DOCKER_LOGIN_PASSWORD }}" | docker login --username "${{ secrets.DOCKER_LOGIN_USERNAME }}" --password-stdin
cd dockerfiles
find ./ -name "*.sh" -exec chmod +x {} \;
./deploy_target.sh 1_full ${PYTHON_${{ matrix.python-version }}_IMAGE}
cd ..
- uses: actions/upload-artifact@v1
with:
name: dockerfiles
path: dockerfiles
extras:
runs-on: ubuntu-latest
needs: full
strategy:
max-parallel: 8
matrix:
python-version: [3_8, 3_9, 3_10, 3_11, 3_12]
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v1
with:
name: dockerfiles
- name: Build extras containers
shell: bash
run: |
export GIT_HEAD="`git rev-list --count HEAD || echo unknown`+`git rev-parse --short HEAD || echo unknown`"
echo "${{ secrets.DOCKER_LOGIN_PASSWORD }}" | docker login --username "${{ secrets.DOCKER_LOGIN_USERNAME }}" --password-stdin
cd dockerfiles
find ./ -name "*.sh" -exec chmod +x {} \;
./deploy_target.sh 2_extra ${PYTHON_${{ matrix.python-version }}_IMAGE}
cd ..
- uses: actions/upload-artifact@v1
with:
name: dockerfiles
path: dockerfiles
final:
runs-on: ubuntu-latest
needs: extras
strategy:
max-parallel: 8
matrix:
python-version: [3_8, 3_9, 3_10, 3_11, 3_12]
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v1
with:
name: dockerfiles
- name: Build final containers
shell: bash
run: |
export GIT_HEAD="`git rev-list --count HEAD || echo unknown`+`git rev-parse --short HEAD || echo unknown`"
echo "${{ secrets.DOCKER_LOGIN_PASSWORD }}" | docker login --username "${{ secrets.DOCKER_LOGIN_USERNAME }}" --password-stdin
cd dockerfiles
find ./ -name "*.sh" -exec chmod +x {} \;
./deploy_target.sh discordpy ${PYTHON_${{ matrix.python-version }}_IMAGE}
cd ..
- uses: actions/upload-artifact@v1
with:
name: dockerfiles
path: dockerfiles