From: Waldemar Kozaczuk <jwkozac...@gmail.com> Committer: Waldemar Kozaczuk <jwkozac...@gmail.com> Branch: master
docker: add docker files defining base images This patch adds 2 new docker files - one for Fedora and another for Ubuntu - that in essence provide all packages installed by setup.py. This patch also adds new generic docker builder file that is based on one of the base images. Signed-off-by: Waldemar Kozaczuk <jwkozac...@gmail.com> --- diff --git a/docker/Dockerfile.builder b/docker/Dockerfile.builder --- a/docker/Dockerfile.builder +++ b/docker/Dockerfile.builder @@ -0,0 +1,52 @@ +# +# Copyright (C) 2017 XLAB, Ltd. +# Copyright (C) 2018-2020 Waldemar Kozaczuk +# +# This work is open source software, licensed under the terms of the +# BSD license as described in the LICENSE file in the top-level directory. +# +# This Docker file defines a container intended to build, test and publish +# OSv kernel as well as many applications ... +# +ARG DIST="fedora-29" +FROM osv/builder-${DIST}-base + +# +# PREPARE ENVIRONMENT +# + +# - prepare directories +RUN mkdir -p /git-repos + +# - clone OSv +WORKDIR /git-repos +ARG GIT_ORG_OR_USER=cloudius-systems +RUN git clone --depth 50 https://github.com/${GIT_ORG_OR_USER}/osv.git +WORKDIR /git-repos/osv +RUN git submodule update --init --recursive + +# - update all required packages in case they have changed +RUN scripts/setup.py + +CMD /bin/bash + +# +# NOTES +# +# Build the container based on default Fedora 29 base image: +# docker build -t osv/builder-fedora-29 -f Dockerfile.builder . +# +# Build the container based of specific Ubuntu version +# docker build -t osv/builder-ubuntu-19.10 -f Dockerfile.builder --build-arg DIST="ubuntu-19.10" . +# +# Build the container based of specific Fedora version and git repo owner (if forked) example: +# docker build -t osv/builder-fedora-31 -f Dockerfile.builder --build-arg DIST="fedora-31" --build-arg GIT_ORG_OR_USER=a_user . +# +# Run the container FIRST time example: +# docker run -it --privileged osv/builder-fedora-29 +# +# To restart: +# docker restart ID (from docker ps -a) && docker attach ID +# +# To open in another console +# docker exec -it ID /bin/bash diff --git a/docker/Dockerfile.builder-fedora-base b/docker/Dockerfile.builder-fedora-base --- a/docker/Dockerfile.builder-fedora-base +++ b/docker/Dockerfile.builder-fedora-base @@ -0,0 +1,36 @@ +# +# Copyright (C) 2020 Waldemar Kozaczuk +# +# This work is open source software, licensed under the terms of the +# BSD license as described in the LICENSE file in the top-level directory. +# +# This Docker file defines an image based on Ubuntu distribution and provides +# all packages necessary to build and run kernel and applications. +# +ARG DIST_VERSION=29 +FROM fedora:${DIST_VERSION} + +RUN yum install -y git python3 file which + +# +# PREPARE ENVIRONMENT +# + +# - prepare directories +RUN mkdir /git-repos + +# - clone OSv just to get setup.py +WORKDIR /git-repos +ARG GIT_ORG_OR_USER=cloudius-systems +RUN git clone --depth 1 -b master --single-branch https://github.com/${GIT_ORG_OR_USER}/osv.git +WORKDIR /git-repos/osv + +# - install all required packages and remove OSv git repo +RUN scripts/setup.py +RUN rm -rf /git-repos + +# - install Capstan +RUN wget https://github.com/cloudius-systems/capstan/releases/latest/download/capstan -O /usr/local/bin/capstan +RUN chmod u+x /usr/local/bin/capstan + +CMD /bin/bash diff --git a/docker/Dockerfile.builder-ubuntu-base b/docker/Dockerfile.builder-ubuntu-base --- a/docker/Dockerfile.builder-ubuntu-base +++ b/docker/Dockerfile.builder-ubuntu-base @@ -0,0 +1,44 @@ +# +# Copyright (C) 2020 Waldemar Kozaczuk +# +# This work is open source software, licensed under the terms of the +# BSD license as described in the LICENSE file in the top-level directory. +# +# This Docker file defines an image based on Ubuntu distribution and provides +# all packages necessary to build and run kernel and applications. +# +ARG DIST_VERSION=19.04 +FROM ubuntu:${DIST_VERSION} + +ENV DEBIAN_FRONTEND noninteractive +ENV TERM=linux + +COPY ./etc/keyboard /etc/default/keyboard +COPY ./etc/console-setup /etc/default/console-setup + +RUN apt-get update -y && apt-get install -y git python3 + +# +# PREPARE ENVIRONMENT +# + +# - prepare directories +RUN mkdir /git-repos + +# - clone OSv +WORKDIR /git-repos +ARG GIT_ORG_OR_USER=cloudius-systems +RUN git clone --depth 1 -b master --single-branch https://github.com/${GIT_ORG_OR_USER}/osv.git +WORKDIR /git-repos/osv + +# - install all required packages and delete OSv repo +RUN scripts/setup.py +RUN rm -rf /git-repos + +RUN update-alternatives --set java /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java + +# - install Capstan +RUN wget https://github.com/cloudius-systems/capstan/releases/latest/download/capstan -O /usr/local/bin/capstan +RUN chmod u+x /usr/local/bin/capstan + +CMD /bin/bash -- You received this message because you are subscribed to the Google Groups "OSv Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to osv-dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/osv-dev/000000000000f1f93a05a0516a43%40google.com.