Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions docker/base.dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM csegarragonz/dotfiles:0.2.0 AS dotfiles
FROM ubuntu:22.04
FROM csegarragonz/dotfiles:0.3.0 AS dotfiles
FROM ubuntu:24.04

# ---------------------------
# Work. Env. Set-Up (do this first to benefit from caching)
Expand All @@ -15,6 +15,7 @@ RUN apt update \
g++ \
gcc \
git \
gpg \
gopls \
libclang-dev \
libdevmapper-dev \
Expand Down
2 changes: 1 addition & 1 deletion docker/containerd.dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/sc2-sys/base:0.10.0
FROM ghcr.io/sc2-sys/base:0.12.0

# ---------------------------
# containerd source set-up
Expand Down
5 changes: 2 additions & 3 deletions docker/kata.dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/sc2-sys/base:0.10.0
FROM ghcr.io/sc2-sys/base:0.12.0

# ---------------------------
# Kata Containers source set-up
Expand All @@ -7,8 +7,7 @@ FROM ghcr.io/sc2-sys/base:0.10.0
# Install APT dependencies
RUN apt install -y \
libseccomp-dev \
musl-tools \
wget
musl-tools

# ---------------------------
# Build Kata
Expand Down
3 changes: 2 additions & 1 deletion docker/nydus.dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/sc2-sys/base:0.10.0
FROM ghcr.io/sc2-sys/base:0.12.0

# ---------------------------
# Nydus daemon set-up
Expand All @@ -13,6 +13,7 @@ RUN mkdir -p ${CODE_DIR} \
${CODE_DIR} \
&& git config --global --add safe.directory ${CODE_DIR} \
&& cd ${CODE_DIR} \
&& rustup toolchain install 1.75.0-x86_64-unknown-linux-gnu \
&& DOCKER=false GOPROXY=https://proxy.golang.org make all-release

WORKDIR ${CODE_DIR}
2 changes: 1 addition & 1 deletion docker/nydus_snapshotter.dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/sc2-sys/base:0.10.0
FROM ghcr.io/sc2-sys/base:0.12.0

# ---------------------------
# Nydus snapshotter daemon set-up
Expand Down
2 changes: 1 addition & 1 deletion docker/ovmf.dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/sc2-sys/base:0.10.0
FROM ghcr.io/sc2-sys/base:0.12.0

RUN apt update \
&& apt upgrade -y \
Expand Down
3 changes: 1 addition & 2 deletions docker/svsm.dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
FROM ghcr.io/sc2-sys/base:0.10.0
FROM ghcr.io/sc2-sys/base:0.12.0

RUN apt update \
&& apt upgrade -y \
&& apt install -y \
autoconf \
autoconf-archive \
libclang-dev \
libssl-dev \
pkg-config

Expand Down
2 changes: 1 addition & 1 deletion docker/svsm_kernel.dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/sc2-sys/base:0.10.0
FROM ghcr.io/sc2-sys/base:0.12.0

RUN apt update \
&& apt upgrade -y \
Expand Down
2 changes: 1 addition & 1 deletion docker/svsm_qemu.dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/sc2-sys/base:0.10.0
FROM ghcr.io/sc2-sys/base:0.12.0

RUN apt update \
&& apt upgrade -y \
Expand Down
4 changes: 2 additions & 2 deletions tasks/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from invoke import Collection

from . import base
from . import coco
from . import containerd
from . import cosign
from . import demo_apps
from . import docker
from . import format_code
from . import gc
from . import kernel
Expand All @@ -26,11 +26,11 @@
from . import svsm

ns = Collection(
base,
coco,
containerd,
cosign,
demo_apps,
docker,
format_code,
gc,
k8s,
Expand Down
22 changes: 0 additions & 22 deletions tasks/base.py

This file was deleted.

23 changes: 4 additions & 19 deletions tasks/containerd.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
from os.path import join
from subprocess import run
from tasks.util.containerd import (
CONTAINERD_IMAGE_TAG,
build_containerd_image,
is_containerd_active,
restart_containerd,
wait_for_containerd_socket,
Expand All @@ -13,8 +15,6 @@
CONF_FILES_DIR,
CONTAINERD_CONFIG_FILE,
CONTAINERD_CONFIG_ROOT,
GHCR_URL,
GITHUB_ORG,
PROJ_ROOT,
print_dotted_line,
)
Expand All @@ -23,9 +23,6 @@
from time import sleep

CONTAINERD_CTR_NAME = "containerd-workon"
CONTAINERD_IMAGE_TAG = (
join(GHCR_URL, GITHUB_ORG, "containerd") + f":{CONTAINERD_VERSION}"
)

CONTAINERD_BINARY_NAMES = [
"containerd",
Expand All @@ -37,24 +34,12 @@
CONTAINERD_HOST_BINPATH = "/usr/bin"


def do_build(nocache=False):
docker_cmd = "docker build{} -t {} -f {} .".format(
" --no-cache" if nocache else "",
CONTAINERD_IMAGE_TAG,
join(PROJ_ROOT, "docker", "containerd.dockerfile"),
)
run(docker_cmd, shell=True, check=True, cwd=PROJ_ROOT)


@task
def build(ctx, nocache=False, push=False):
"""
Build the containerd fork for CoCo
Build the containerd fork for SC2
"""
do_build(nocache=nocache)

if push:
run(f"docker push {CONTAINERD_IMAGE_TAG}", shell=True, check=True)
build_containerd_image(nocache=nocache, push=push)


@task
Expand Down
82 changes: 82 additions & 0 deletions tasks/docker.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
from invoke import task
from os.path import join
from tasks.svsm import build_svsm_image, build_svsm_kernel_image, build_svsm_qemu_image
from tasks.util.containerd import build_containerd_image
from tasks.util.docker import BASE_IMAGE_TAG, build_image
from tasks.util.env import PROJ_ROOT, print_dotted_line
from tasks.util.kata import build_kata_image
from tasks.util.nydus import build_nydus_image
from tasks.util.nydus_snapshotter import build_nydus_snapshotter_image
from tasks.util.ovmf import build_ovmf_image
from tasks.util.versions import (
CONTAINERD_VERSION,
GO_VERSION,
KATA_VERSION,
NYDUS_VERSION,
NYDUS_SNAPSHOTTER_VERSION,
OVMF_VERSION,
)


def build_base_image(nocache, push, debug=True):
build_image(
BASE_IMAGE_TAG,
join(PROJ_ROOT, "docker", "base.dockerfile"),
build_args={"GO_VERSION": GO_VERSION},
nocache=nocache,
push=push,
debug=debug,
)


@task
def build_base(ctx, nocache=False, push=False):
"""
Build base docker container
"""
build_base_image(nocache, push)


@task
def build_all(ctx, nocache=False, push=False):
"""
Build all work-on container images
"""
print_dotted_line("Building base image")
build_base_image(nocache, push, debug=False)
print("Success!")

print_dotted_line(f"Building containerd image (v{CONTAINERD_VERSION})")
build_containerd_image(nocache, push, debug=False)
print("Success!")

print_dotted_line(f"Building kata image (v{KATA_VERSION})")
build_kata_image(nocache, push, debug=False)
print("Success!")

print_dotted_line(f"Building nydus image (v{NYDUS_VERSION})")
build_nydus_image(nocache, push, debug=False)
print("Success!")

print_dotted_line(
f"Building nydus-snapshotter image (v{NYDUS_SNAPSHOTTER_VERSION})"
)
build_nydus_snapshotter_image(nocache, push, debug=False)
print("Success!")

print_dotted_line(f"Building OVMF image ({OVMF_VERSION})")
build_ovmf_image(nocache, push, debug=False)
print("Success!")

print_dotted_line("Building SVSM guest kernel image")
build_svsm_kernel_image(nocache, push, debug=False)
print("Success!")

print_dotted_line("Building SVSM QEMU image")
build_svsm_qemu_image(nocache, push, debug=False)
print("Success!")

# This must be after SVSM's qemu and kernel
print_dotted_line("Building SVSM IGVM image")
build_svsm_image(nocache, push, debug=False)
print("Success!")
Loading
Loading