Skip to content

Commit

Permalink
Convert dokken-centos7 to use a bake file
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorific committed Nov 20, 2023
1 parent ac7d2b0 commit 5a8d142
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 24 deletions.
18 changes: 4 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,33 +107,23 @@ jobs:
id: image_name
run: |
json_data="$(docker buildx bake --print 2>/dev/null)"
if echo "$json_data" | jq -e '.target.default.labels["dev.polymathrobotics.image.readme-filepath"]' > /dev/null; then
image_name=$(echo $json_data | jq -r '.target."release-default".["dev.polymathrobotics.image.title"]')
echo "image_name=$image_name" >> $GITHUB_ENV
else
echo "image_name=$(docker buildx bake --print 2>/dev/null | jq -r '.target.default.labels."org.opencontainers.image.title"')" >> $GITHUB_ENV
fi
echo "$json_data" | jq -r '.target.default.labels."org.opencontainers.image.title"')" >> $GITHUB_ENV
- name: Get the image description
if: github.event_name != 'pull_request'
id: image_description
run: |
json_data="$(docker buildx bake --print 2>/dev/null)"
if echo "$json_data" | jq -e '.target.default.labels["dev.polymathrobotics.image.readme-filepath"]' > /dev/null; then
image_description=$(echo $json_data | jq -r '.target."release-default".labels["dev.polymathrobotics.image.description"]')
echo "image_description=$image_name" >> $GITHUB_ENV
else
echo "image_description=$(docker buildx bake --print 2>/dev/null | jq -r '.target.default.labels."org.opencontainers.image.description"')" >> $GITHUB_ENV
fi
echo "$json_data" | jq -r '.target.default.labels."org.opencontainers.image.description"')" >> $GITHUB_ENV
- name: Get the image readme filepath
if: github.event_name != 'pull_request'
id: image_readme_filepath
run: |
# Check if .group.local.targets.default exists, and if it does, extract its value
json_data="$(docker buildx bake --print 2>/dev/null)"
if echo "$json_data" | jq -e '.target.default.labels["dev.polymathrobotics.image.readme-filepath"]' > /dev/null; then
readme_filepath=$(echo $json_data | jq -r '.target.default.labels["dev.polymathrobotics.image.readme-filepath"]')
if echo "$json_data" | jq -e '.target.default.labels["io.boxcutter.image.readme-filepath"]' > /dev/null; then
readme_filepath=$(echo $json_data | jq -r '.target.default.labels["io.boxcutter.image.readme-filepath"]')
echo "image_readme_filepath=$readme_filepath" >> $GITHUB_ENV
else
echo "image_readme_filepath=${{ matrix.image }}/README.md" >> $GITHUB_ENV
Expand Down
5 changes: 0 additions & 5 deletions dokken/centos-7/Containerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
ARG CONTAINER_REGISTRY=docker.io
FROM $CONTAINER_REGISTRY/centos:7

LABEL \
org.opencontainers.image.source="https://github.com/polymathrobotics/oci" \
org.opencontainers.image.licenses="Apache-2.0" \
org.opencontainers.image.description="CentOS 7 image for kitchen-dokken"

RUN <<EOF
yum -y install yum-plugin-copr
yum -y copr enable jsynacek/systemd-backports-for-centos-7
Expand Down
5 changes: 0 additions & 5 deletions dokken/centos-7/Polly.toml

This file was deleted.

36 changes: 36 additions & 0 deletions dokken/centos-7/docker-bake.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
variable "IMAGE_NAME" {
default = "dokken-centos-7"
}

variable "CONTAINER_REGISTRY" {
default = "docker.io/boxcutter"
}

# There's no darwin-based Docker, so if we're running on macOS, change the platform to linux
variable "LOCAL_PLATFORM" {
default = regex_replace("${BAKE_LOCAL_PLATFORM}", "^(darwin)", "linux")
}

target "_common" {
dockerfile = "Containerfile"
tags = [
"${CONTAINER_REGISTRY}/${IMAGE_NAME}:latest"
]
labels = {
"org.opencontainers.image.source" = "https://github.com/polymathrobotics/oci"
"org.opencontainers.image.licenses" = "Apache-2.0"
"org.opencontainers.image.description" = "CentOS 7 image for kitchen-dokken"
"org.opencontainers.image.title" = "${IMAGE_NAME}"
"io.boxcutter.image.readme-filepath" = "dokken/README.md"
}
}

target "local" {
inherits = ["_common"]
platforms = ["${LOCAL_PLATFORM}"]
}

target "default" {
inherits = ["_common"]
platforms = ["linux/amd64", "linux/arm64/v8"]
}

0 comments on commit 5a8d142

Please sign in to comment.