Add the builder tasks to build and release docker images

This commit is contained in:
Sameer Rahmani 2022-02-15 21:34:29 +00:00
parent bcbf49c1a1
commit 49e3f16901
10 changed files with 110 additions and 30 deletions

4
.gitignore vendored
View File

@ -25,4 +25,6 @@ bin/serenec_CXX_cotire.cmake
docs/Doxyfile.docs
.ccache/
docs/spec.tex
docs/spec.pdf
docs/spec.pdf
.env

View File

@ -228,16 +228,6 @@ if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
add_subdirectory(include)
if (SERENE_ENABLE_DOCS)
# Docs only available if this is the main app
find_package(Doxygen
REQUIRED dot
OPTIONAL_COMPONENTS dia)
if(Doxygen_FOUND)
message(STATUS "Found Doxygen, building the docs")
add_subdirectory(docs)
else()
message(STATUS "Doxygen not found, not building the docs")
endif()
add_subdirectory(docs)
endif()
endif()

44
builder
View File

@ -176,14 +176,46 @@ function tests() { ## Generates and build the project including the test cases
popd_build
}
# function docker-llvm() { #
# docker build -f resources/docker/Dockerfile.llvm -t serene/llvm:15-1 .
# }
function build-llvm-image() { ## Build the LLVM image that we use to build Serene's image
source .env
docker build \
-f $ME/resources/docker/llvm/Dockerfile \
-t $REGISTRY/llvm:$1-$2 \
--build-arg VERSION=$1 \
.
function docker-serene() { ## Build the Serene docker image for the current HEAD
docker build -f resources/docker/Dockerfile.serene -t serene/build:$(git rev-parse HEAD) .
}
function push-llvm-image() { ## Pushes the LLVM image to the registery
source .env
docker login $REGISTRY -u $SERENE_REGISTERY_USER -p $SERENE_REGISTERY_PASS
docker push $REGISTRY/llvm:$1
}
function build-serene-image() { ## Build the Serene docker image for the current HEAD
source .env
docker build \
-f $ME/resources/docker/serene/Dockerfile \
-t $REGISTRY/serene:$VERSION-$(git rev-parse HEAD) \
.
}
function release-serene-image() { ## Build and push the Serene docker image for the current HEAD in Release mode
source .env
docker build \
-f $ME/resources/docker/serene/Dockerfile \
-t $REGISTRY/serene:$VERSION \
--build-arg TASK=build-release \
.
docker login $REGISTRY -u $SERENE_REGISTERY_USER -p $SERENE_REGISTERY_PASS
docker push $REGISTRY/serene:$VERSION
}
function setup() { ## Setup the working directory and make it ready for development
rm -rfv $ME/.git/hooks/pre-commit
ln -s $ME/scripts/pre-commit $ME/.git/hooks/pre-commit
@ -203,7 +235,7 @@ echo "Commands:"
grep -E '^function [a-zA-Z0-9_-]+\(\) \{ ## .*$$' $0 | \
sort | \
sed 's/^function \([a-zA-Z0-9_-]*\)() { ## \(.*\)/\1:\2/' | \
awk 'BEGIN {FS=":"}; {printf "\033[36m%-20s\033[0m %s\n", $1, $2}'
awk 'BEGIN {FS=":"}; {printf "\033[36m%-30s\033[0m %s\n", $1, $2}'
}
# -----------------------------------------------------------------------------

View File

@ -78,6 +78,7 @@ private:
};
class SERENE_EXPORT Halley {
// TODO: Replace this with a variant of LLJIT and LLLazyJIT
std::unique_ptr<llvm::orc::LLJIT> engine;
std::unique_ptr<ObjectCache> cache;

View File

@ -1,12 +0,0 @@
FROM serene/llvm:15
RUN apt-get update --fix-missing && apt-get install -y wget gnupg ccache cmake ccache git ninja-build build-essential binutils libncurses-dev
WORKDIR /app
COPY . .
ENV PATH="/opt/llvm/bin:$PATH"
ENV CXX=clang++
ENV CC=clang
ENV LDFLAGS="-fuse-ld=lld"
RUN LD_LIBRARY_PATH="$(clang -print-runtime-dir):$LD_LIBRARY_PATH" ./builder build

View File

@ -0,0 +1,39 @@
FROM debian:sid-slim
ARG VERSION
RUN apt-get update && apt-get install -y wget \
gnupg \
ccache \
cmake \
ccache \
git \
ninja-build \
build-essential \
binutils \
lsb-release \
wget \
software-properties-common \
zlib1g \
zlib1g-dev
RUN wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh
RUN ./llvm.sh ${VERSION} all
RUN apt-get update --fix-missing && \
apt-get install -y mlir-${VERSION}-tools \
libmlir-${VERSION}-dev \
libmlir-${VERSION} \
libmlir-${VERSION}-dbgsym \
liblld-${VERSION} \
liblld-${VERSION}-dev
RUN ln -s `which lld-${VERSION}` /usr/bin/lld && \
ln -s `which clang-${VERSION}` /usr/bin/clang && \
ln -s `which clang++-${VERSION}` /usr/bin/clang++ && \
ln -s `which mlir-tblgen-${VERSION}` /usr/bin/mlir-tblgen
ENV MLIR_DIR /usr/lib/llvm-${VERSION}
ENV CMAKE_PREFIX_PATH=/usr/lib/llvm-${VERSION}
ENV LD_LIBRARY_PATH=/usr/lib/llvm-${VERSION}/lib/clang/${VERSION}.0.0/lib/linux/
RUN apt-get clean

View File

@ -0,0 +1,18 @@
SERENE_VERSION=15
BUILD_NO=4
REGISTRY=rg.fr-par.scw.cloud/serene
include $(ENVFILE)
.PHONY: build-dev
build-dev:
docker build -t $(REGISTRY)/serene:$(SERENE_VERSION)-$(TAG) $(SOURCE_PATH)
.PHONY: build
build:
docker build -t $(REGISTRY)/serene:$(SERENE_VERSION) --build-arg TASK=build-release .
.PHONY: release
release:
docker login $(REGISTRY) -u $(SERENE_REGISTERY_USER) -p $(SERENE_REGISTERY_PASS)
docker push $(REGISTRY)/serene:$(SERENE_VERSION)

View File

@ -0,0 +1 @@
lxsameer@underworld.2962235:1638986649

View File

@ -0,0 +1,9 @@
FROM rg.fr-par.scw.cloud/serene/llvm:15-4
ARG TASK=build
WORKDIR /app
COPY . .
RUN ./builder ${TASK}