Skip to content

Build and Push Docker Images #73

Build and Push Docker Images

Build and Push Docker Images #73

Workflow file for this run

name: Build and Push Docker Images
on:
workflow_dispatch:
push:
branches:
- "main"
- "releases/**"
jobs:
build-and-push:
runs-on: ubuntu-latest
strategy:
matrix:
template:
- workspace_base
- workspace_cuda_11_1
- workspace_cuda_11_3
- workspace_cuda_11_7
- workspace_cuda_11_8
- workspace_cuda_12_1
- runtime_node_lts
- workspace_node_16
- workspace_node_18
- workspace_node_20
- workspace_pytorch_1_13
- workspace_pytorch_2_0
- workspace_pytorch_2_1
- workspace_pytorch_2_2
- workspace_protein
max-parallel: 4
steps:
# https://github.com/easimon/maximize-build-space/blob/test-report/README.md
- name: Maximize build space
uses: easimon/maximize-build-space@master
with:
root-reserve-mb: 35000
swap-size-mb: 1024
remove-dotnet: "true"
remove-android: "true"
remove-haskell: "true"
remove-codeql: "true"
remove-docker-images: "true"
- name: Checkout
uses: actions/checkout@v4
- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Space After Cache
run: |
echo "Free space:"
df -h
# https://docs.docker.com/build/cache/backends/#cache-mode
- name: Build and Push Docker Image
id: docker_build
uses: docker/build-push-action@v5
with:
context: dockerlab/templates/${{ matrix.template }}
push: true
tags: |
deepbase/dockerlab:${{ matrix.template }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
- name: Docker Hub Description
id: dockerhub-description
uses: peter-evans/dockerhub-description@v4
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
repository: deepbase/dockerlab
readme-filepath: dockerlab/templates/README.md