Skip to content

Commit

Permalink
Convert content builds to use bake
Browse files Browse the repository at this point in the history
  • Loading branch information
ianpittwood committed Apr 5, 2024
1 parent 0dbf4a5 commit 9bd2b71
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 31 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/build-bake.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,23 @@ jobs:
targets: "build"
push: true

build-content:
runs-on: ubuntu-latest-4x
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push
uses: docker/bake-action@v4
with:
push: false

- name: Build and push
if: github.ref == 'refs/heads/main'
uses: docker/bake-action@v4
with:
push: true

82 changes: 82 additions & 0 deletions content/docker-bake.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
variable CONTENT_BUILD_MATRIX {
default = {
builds = [
{os = "ubuntu1804", os_alt = "bionic", r = "3.1.3", py = "2.7.18", drivers = "2024.03.0", quarto = "1.0.37"},
{os = "ubuntu1804", os_alt = "bionic", r = "3.2.5", py = "2.7.18", drivers = "2024.03.0", quarto = "1.0.37"},
{os = "ubuntu1804", os_alt = "bionic", r = "3.3.3", py = "3.6.13", drivers = "2024.03.0", quarto = "1.0.37"},
{os = "ubuntu1804", os_alt = "bionic", r = "3.4.4", py = "3.6.13", drivers = "2024.03.0", quarto = "1.0.37"},
{os = "ubuntu1804", os_alt = "bionic", r = "3.4.4", py = "3.7.10", drivers = "2024.03.0", quarto = "1.0.37"},
{os = "ubuntu1804", os_alt = "bionic", r = "3.5.3", py = "2.7.18", drivers = "2024.03.0", quarto = "1.0.37"},
{os = "ubuntu1804", os_alt = "bionic", r = "3.5.3", py = "3.7.10", drivers = "2024.03.0", quarto = "1.0.37"},
{os = "ubuntu1804", os_alt = "bionic", r = "3.6.3", py = "2.7.18", drivers = "2024.03.0", quarto = "1.0.37"},
{os = "ubuntu1804", os_alt = "bionic", r = "3.6.3", py = "3.6.13", drivers = "2024.03.0", quarto = "1.0.37"},
{os = "ubuntu1804", os_alt = "bionic", r = "3.6.3", py = "3.8.8", drivers = "2024.03.0", quarto = "1.0.37"},
{os = "ubuntu1804", os_alt = "bionic", r = "4.0.5", py = "3.6.13", drivers = "2024.03.0", quarto = "1.0.37"},
{os = "ubuntu1804", os_alt = "bionic", r = "4.0.5", py = "3.7.10", drivers = "2024.03.0", quarto = "1.0.37"},
{os = "ubuntu1804", os_alt = "bionic", r = "4.0.5", py = "3.8.8", drivers = "2024.03.0", quarto = "1.0.37"},
{os = "ubuntu1804", os_alt = "bionic", r = "4.0.5", py = "3.9.2", drivers = "2024.03.0", quarto = "1.0.37"},
{os = "ubuntu1804", os_alt = "bionic", r = "4.1.0", py = "3.8.8", drivers = "2024.03.0", quarto = "1.0.37"},
{os = "ubuntu1804", os_alt = "bionic", r = "4.1.0", py = "3.9.2", drivers = "2024.03.0", quarto = "1.0.37"},
{os = "ubuntu1804", os_alt = "bionic", r = "4.1.3", py = "3.10.4", drivers = "2024.03.0", quarto = "1.0.37"},
{os = "ubuntu2204", os_alt = "jammy", r = "3.6.3", py = "3.8.16", drivers = "2024.03.0", quarto = "1.3.340"},
{os = "ubuntu2204", os_alt = "jammy", r = "4.0.5", py = "3.9.16", drivers = "2024.03.0", quarto = "1.3.340"},
{os = "ubuntu2204", os_alt = "jammy", r = "4.1.3", py = "3.10.11", drivers = "2024.03.0", quarto = "1.3.340"},
{os = "ubuntu2204", os_alt = "jammy", r = "4.2.2", py = "3.11.3", drivers = "2024.03.0", quarto = "1.3.340"},
]
}
}

group "default" {
targets = ["base", "pro"]
}

target "base" {
name = "content-base-r${replace(builds.r, ".", "-")}-py${replace(builds.py, ".", "-")}-${builds.os}"

tags = [
"ghcr.io/rstudio/content-base:r${builds.r}-py${builds.py}-${builds.os}",
"ghcr.io/rstudio/content-base:r${builds.r}-py${builds.py}-${builds.os_alt}",
"docker.io/rstudio/content-base:r${builds.r}-py${builds.py}-${builds.os}",
"docker.io.io/rstudio/content-base:r${builds.r}-py${builds.py}-${builds.os_alt}",
]
output = [
"type=cacheonly",
]

dockerfile = "Dockerfile.${builds.os}"
context = "base"

matrix = CONTENT_BUILD_MATRIX
args = {
R_VERSION = "${builds.r}"
PYTHON_VERSION = "${builds.py}"
QUARTO_VERSION = "${builds.quarto}"
}
}

target "pro" {
name = "content-pro-r${replace(builds.r, ".", "-")}-py${replace(builds.py, ".", "-")}-${builds.os}"

tags = [
"ghcr.io/rstudio/content-pro:r${builds.r}-py${builds.py}-${builds.os}",
"ghcr.io/rstudio/content-pro:r${builds.r}-py${builds.py}-${builds.os_alt}",
"docker.io/rstudio/content-pro:r${builds.r}-py${builds.py}-${builds.os}",
"docker.io.io/rstudio/content-pro:r${builds.r}-py${builds.py}-${builds.os_alt}",
]
output = [
"type=cacheonly",
]

contexts = {
content-base = "target:content-base-r${replace(builds.r, ".", "-")}-py${replace(builds.py, ".", "-")}-${builds.os}"
}

dockerfile = "Dockerfile.${builds.os}"
context = "pro"

matrix = CONTENT_BUILD_MATRIX
args = {
R_VERSION = "${builds.r}"
DRIVERS_VERSION = "${builds.drivers}"
}
}
23 changes: 0 additions & 23 deletions content/matrix.json

This file was deleted.

5 changes: 1 addition & 4 deletions content/pro/Dockerfile.ubuntu1804
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
ARG PYTHON_VERSION
ARG R_VERSION
ARG REGISTRY=ghcr.io
FROM ${REGISTRY}/rstudio/content-base:r${R_VERSION}-py${PYTHON_VERSION}-ubuntu1804
FROM content-base

LABEL maintainer="RStudio Docker <[email protected]>"

Expand Down
5 changes: 1 addition & 4 deletions content/pro/Dockerfile.ubuntu2204
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
ARG PYTHON_VERSION
ARG R_VERSION
ARG REGISTRY=ghcr.io
FROM ${REGISTRY}/rstudio/content-base:r${R_VERSION}-py${PYTHON_VERSION}-ubuntu2204
FROM content-base

LABEL maintainer="RStudio Docker <[email protected]>"

Expand Down

0 comments on commit 9bd2b71

Please sign in to comment.