Skip to content

Suggestion/Question: Provide Docker build environment #278

@Jeansen

Description

@Jeansen

I've created a Docker file for myself that I use to build everything I need an copy it over to my host. The release version can be chosen when calling the container and it will then build that library version. Here's how it looks like. So far, this is my personal playground but I could polish it a bit and contribute it to this repo. Please let me know if this is something of interest.

#Run example: podman run --rm -v $(pwd):/transfer -e VERSION=v0.11.0 kbuild:latest
#If version is missing, latest tag will be used.
#Compiled library and header files will be copied to /transfer/$VERSION.

FROM debian:bookworm

ENV GIT_SSL_NO_VERIFY=true

RUN <<EOT bash
  set -ex
  apt-get update
  apt-get install --no-install-recommends -y libssl-dev libcurl4-openssl-dev libwebsockets-dev uncrustify git cmake gcc g++ make
  apt-get clean
EOT


RUN git clone https://github.com/kubernetes-client/c.git  /k
RUN git clone https://github.com/yaml/libyaml.git  /y

WORKDIR /y/build
RUN cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_TESTING=OFF  -DBUILD_SHARED_LIBS=ON .. && make && make install

WORKDIR /k/kubernetes/build
ENTRYPOINT git pull && \
    version=${VERSION:-$(git tag | sort -V | tail -n 1)} && \
    git checkout $version && \
    cmake -DCMAKE_INSTALL_PREFIX=/usr/local ..  && \
    make && \
    make install && \
    mkdir -p /transfer/$version && \
    cp *.so /transfer/$version && \
    cp -r /usr/local/include/kubernetes /transfer/$version

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions