Skip to content

Commit

Permalink
wip initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mauromorales committed Oct 9, 2023
1 parent be7961b commit bdcd8c5
Show file tree
Hide file tree
Showing 8 changed files with 103 additions and 33 deletions.
16 changes: 8 additions & 8 deletions .github/flavors-arm.json
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
[
{
"flavor": "opensuse-leap-arm-rpi",
"flavor": "opensuse-leap",
"model": "rpi4",
"worker": "ubuntu-latest",
"standard": "true"
},
{
"flavor": "opensuse-tumbleweed-arm-rpi",
"flavor": "opensuse-tumbleweed",
"model": "rpi4",
"worker": "ubuntu-latest",
"standard": "true"
},
{
"flavor": "alpine-arm-rpi",
"flavor": "alpine",
"model": "rpi4",
"worker": "ubuntu-latest",
"standard": "true"
},
{
"flavor": "ubuntu-arm-rpi",
"flavor": "ubuntu",
"model": "rpi4",
"worker": "ubuntu-latest",
"standard": "true"
},
{
"flavor": "ubuntu-20-lts-arm-rpi",
"flavor": "ubuntu-20-lts",
"model": "rpi4",
"worker": "ubuntu-latest",
"standard": "true"
},
{
"flavor": "ubuntu-22-lts-arm-rpi",
"flavor": "ubuntu-22-lts",
"model": "rpi4",
"worker": "ubuntu-latest",
"standard": "true"
},
{
"flavor": "ubuntu-20-lts-arm-nvidia-jetson-agx-orin",
"model": "none",
"flavor": "ubuntu-20-lts",
"model": "jetson-agx-orin",
"worker": "fast"
}
]
41 changes: 41 additions & 0 deletions .github/flavors.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,46 @@
},
{
"flavor": "almalinux"
},
{
"flavor": "opensuse-leap",
"model": "rpi4",
"worker": "ubuntu-latest",
"standard": "true"
},
{
"flavor": "opensuse-tumbleweed",
"model": "rpi4",
"worker": "ubuntu-latest",
"standard": "true"
},
{
"flavor": "alpine",
"model": "rpi4",
"worker": "ubuntu-latest",
"standard": "true"
},
{
"flavor": "ubuntu",
"model": "rpi4",
"worker": "ubuntu-latest",
"standard": "true"
},
{
"flavor": "ubuntu-20-lts",
"model": "rpi4",
"worker": "ubuntu-latest",
"standard": "true"
},
{
"flavor": "ubuntu-22-lts",
"model": "rpi4",
"worker": "ubuntu-latest",
"standard": "true"
},
{
"flavor": "ubuntu-20-lts",
"model": "jetson-agx-orin",
"worker": "fast"
}
]
57 changes: 40 additions & 17 deletions Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -314,25 +314,48 @@ base-image:
ARG HWE

IF [ "$BASE_IMAGE" = "" ]
# DISTRO is used to match the Linux distribution in the Dockerfile e.g. Dockerfile.ubuntu
# This is a bit messy at the moment, but it will be sorted out when we stop including the model and the arch in
# the flavor name e.g. ubuntu-20-lts-arm-rpi
IF [[ "$FLAVOR" =~ ^alpine* ]] # TODO: only needed while we don't have a pure alpine
ARG DISTRO=alpine
ELSE IF [[ "$FLAVOR" = "ubuntu-20-lts-arm-nvidia-jetson-agx-orin" ]] # TODO: needs to still be merged on Dockerfile.ubuntu (or not?)
ARG DISTRO=ubuntu-20-lts-arm-nvidia-jetson-agx-orin
ELSE IF [[ "$FLAVOR" =~ "ubuntu" ]] # TODO: need to find a better way to match the flavor and the distro in the dockerfile for Ubuntu
ARG DISTRO=ubuntu
ELSE
ARG DISTRO=$(echo $FLAVOR | sed 's/-arm-.*//')
IF [ "$FLAVOR" = "ubuntu-20-lts-arm-nvidia-jetson-agx-orin" ]
ARG UPSTREAM_IMAGE=ubuntu:20.04
ARG DISTRO=ubuntu
ELSE IF [ "$FLAVOR" =~ ^ubuntu-20-lts* ]
ARG UPSTREAM_IMAGE=ubuntu:20.04
ARG DISTRO=ubuntu
ELSE IF [ "$FLAVOR" =~ ^ubuntu-22-lts* ]
ARG UPSTREAM_IMAGE=ubuntu:22.04
ARG DISTRO=ubuntu
ELSE IF [ "$FLAVOR" =~ ^ubuntu* ]
ARG UPSTREAM_IMAGE=ubuntu:rolling
ARG DISTRO=ubuntu
ELSE IF [ "$FLAVOR" = "opensuse-leap" ]
ARG UPSTREAM_IMAGE=opensuse/leap:15.5
ARG DISTRO=opensuse
ELSE IF [ "$FLAVOR" = "opensuse-tumbleweed" ]
ARG UPSTREAM_IMAGE=opensuse/tumbleweed
ARG DISTRO=opensuse
ELSE IF [ "$FLAVOR" = "alpine-ubuntu" ]
ARG UPSTREAM_IMAGE=alpine
ARG DISTRO=alpine
ELSE IF [ "$FLAVOR" = "alpine-opensuse-leap" ]
ARG UPSTREAM_IMAGE=alpine
ARG DISTRO=alpine
ELSE IF [ "$FLAVOR" = "fedora" ]
ARG UPSTREAM_IMAGE=fedora:latest
ARG DISTRO=fedora
ELSE IF [ "$FLAVOR" = "debian" ] && [ "$TARGETARCH" = "amd64" ]
ARG UPSTREAM_IMAGE=debian:testing
ARG DISTRO=debian
ELSE IF [ "$FLAVOR" = "debian" ] && [ "$TARGETARCH" = "arm64" ]
ARG UPSTREAM_IMAGE=debian:bookworm-slim
ARG DISTRO=debian
ELSE IF [ "$FLAVOR" = "rockylinux" ]
ARG UPSTREAM_IMAGE=rockylinux:9
ARG DISTRO=rockylinux
ELSE IF [ "$FLAVOR" = "almalinux" ]
ARG UPSTREAM_IMAGE=almalinux:latest
ARG DISTRO=almalinux
END

# SIMPLE_FLAVOR is used to distinguish the flavor inside the Dockerfile, where it's important to make a distinction
# between e.g. ubuntu and ubuntu-20-lts, but we don't really need to know the model and the arch since this is
# defined using MODEL and TARGETARCH.
ARG SIMPLE_FLAVOR=$(echo $FLAVOR | sed 's/-arm-.*//')

FROM DOCKERFILE --build-arg MODEL=$MODEL --build-arg FLAVOR=$SIMPLE_FLAVOR --build-arg HWE=$HWE -f images/Dockerfile.$DISTRO images/
FROM DOCKERFILE --build-arg BASE_IMAGE=$UPSTREAM_IMAGE --build-arg MODEL=$MODEL --build-arg FLAVOR=$FLAVOR --build-arg HWE=$HWE -f images/Dockerfile.$DISTRO images/
ELSE
FROM $BASE_IMAGE
END
Expand Down
3 changes: 2 additions & 1 deletion images/Dockerfile.alpine
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
#### ARGS ####
###############################################################
ARG MODEL=generic
ARG BASE_IMAGE=alpine

###############################################################
#### Common ####
###############################################################
FROM alpine AS common
FROM $BASE_IMAGE AS common
RUN apk --no-cache add \
bash \
bash-completion \
Expand Down
5 changes: 3 additions & 2 deletions images/Dockerfile.debian
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@
#### ARGS ####
###############################################################
ARG MODEL=generic
ARG BASE_IMAGE=debian:testing

###############################################################
#### Upstream Images ####
###############################################################

# we use testing for amd64 because zfsutils-linux is not available in bookworm
FROM debian:testing AS amd64-upstream
FROM $BASE_IMAGE AS amd64-upstream
RUN <<EOF
echo "deb http://deb.debian.org/debian bookworm main contrib" >> /etc/apt/sources.list.d/kairos.list
EOF

FROM debian:bookworm-slim AS arm64-upstream
FROM $BASE_IMAGE AS arm64-upstream

###############################################################
#### Common ####
Expand Down
3 changes: 2 additions & 1 deletion images/Dockerfile.opensuse-leap
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
#### ARGS ####
###############################################################
ARG MODEL=generic
ARG BASE_IMAGE=opensuse/leap:15.5

###############################################################
#### Common ####
###############################################################
FROM opensuse/leap:15.5 AS common
FROM $BASE_IMAGE AS common

RUN zypper ar -G https://download.opensuse.org/repositories/utilities/15.4/utilities.repo && \
zypper ref
Expand Down
3 changes: 2 additions & 1 deletion images/Dockerfile.opensuse-tumbleweed
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
#### ARGS ####
###############################################################
ARG MODEL=generic
ARG BASE_IMAGE=opensuse/tumbleweed

###############################################################
#### Upstream ####
###############################################################
FROM opensuse/tumbleweed AS upstream
FROM $BASE_IMAGE AS upstream

###############################################################
#### Arch Config ####
Expand Down
8 changes: 5 additions & 3 deletions images/Dockerfile.ubuntu
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,19 @@ ARG MODEL=generic
# the default value is empty, which means the HWE kernel WILL be installed
# if you want to disable the HWE kernel, set HWE to "-non-hwe"
ARG HWE=""
ARG BASE_IMAGE=ubuntu:rolling
# TARGETARCH is used to determine the architecture of the image
# it is already set by Docker so it doesn't need to be defined here

###############################################################
#### Upstream Images ####
###############################################################
FROM ubuntu:rolling AS ubuntu-upstream
FROM ${BASE_IMAGE} AS ubuntu-upstream

FROM ubuntu:20.04 AS ubuntu-20-lts-upstream
FROM ${BASE_IMAGE} AS ubuntu-20-lts-upstream

FROM ${BASE_IMAGE} AS ubuntu-22-lts-upstream

FROM ubuntu:22.04 AS ubuntu-22-lts-upstream

###############################################################
#### Pre-Process Common to All ####
Expand Down

0 comments on commit bdcd8c5

Please sign in to comment.