mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-23 01:13:23 +00:00
Build Docker image with CI
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
7b390d9f8a
commit
e7d1437fca
1
tools/docker/.gitignore
vendored
1
tools/docker/.gitignore
vendored
@ -1 +0,0 @@
|
||||
bom/
|
@ -15,14 +15,14 @@ RUN apt update && apt-get install -y --no-install-recommends \
|
||||
python3-pip
|
||||
|
||||
# Install bazel, which is required by the system call test suite from Gvisor project
|
||||
COPY bom/syscall_test/install_bazel.sh /tmp/
|
||||
COPY regression/syscall_test/install_bazel.sh /tmp/
|
||||
WORKDIR /tmp
|
||||
RUN ./install_bazel.sh && rm -f /tmp/install_bazel.sh
|
||||
|
||||
FROM ubuntu-22.04-with-bazel as syscall_test
|
||||
|
||||
# Build the syscall test binaries
|
||||
COPY bom/syscall_test /root/syscall_test
|
||||
COPY regression/syscall_test /root/syscall_test
|
||||
WORKDIR /root/syscall_test
|
||||
RUN export BUILD_DIR=build && \
|
||||
make ${BUILD_DIR}/syscall_test_bins
|
||||
|
@ -1,28 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
CARGO_TOML_PATH=${SCRIPT_DIR}/../../Cargo.toml
|
||||
VERSION=$( grep -m1 -o '[0-9]\+\.[0-9]\+\.[0-9]\+' ${CARGO_TOML_PATH} | sed 's/[^0-9\.]//g' )
|
||||
IMAGE_NAME=jinuxdev/jinux:${VERSION}
|
||||
DOCKER_FILE=${SCRIPT_DIR}/Dockerfile.ubuntu22.04
|
||||
BOM_DIR=${SCRIPT_DIR}/bom
|
||||
TOP_DIR=${SCRIPT_DIR}/../../
|
||||
ARCH=linux/amd64
|
||||
RUST_TOOLCHAIN_PATH=${SCRIPT_DIR}/../../rust-toolchain.toml
|
||||
JINUX_RUST_VERSION=$( grep -m1 -o 'nightly-[0-9]\+-[0-9]\+-[0-9]\+' ${RUST_TOOLCHAIN_PATH} )
|
||||
|
||||
# Prpare the BOM (bill of materials) directory to copy files or dirs into the docker image.
|
||||
# This is because the `docker build` can not access the parent directory of the context.
|
||||
if [ ! -d ${BOM_DIR} ]; then
|
||||
mkdir -p ${BOM_DIR}
|
||||
cp -rf ${TOP_DIR}/regression/syscall_test ${BOM_DIR}/
|
||||
fi
|
||||
|
||||
# Build docker
|
||||
cd ${SCRIPT_DIR}
|
||||
docker buildx build -f ${DOCKER_FILE} \
|
||||
--build-arg JINUX_RUST_VERSION=${JINUX_RUST_VERSION} \
|
||||
--platform ${ARCH} \
|
||||
-t ${IMAGE_NAME} .
|
Reference in New Issue
Block a user