From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vicente Eduardo Subject: Guix in Docker for automated CD/CI of complex software Date: Thu, 21 Nov 2019 08:41:22 -0600 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:42520) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iXneA-0006hH-1X for guix-devel@gnu.org; Thu, 21 Nov 2019 09:41:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iXne8-0006Xl-KX for guix-devel@gnu.org; Thu, 21 Nov 2019 09:41:25 -0500 Received: from mail-il1-x131.google.com ([2607:f8b0:4864:20::131]:32922) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iXne8-0006Xc-EA for guix-devel@gnu.org; Thu, 21 Nov 2019 09:41:24 -0500 Received: by mail-il1-x131.google.com with SMTP id m5so3523265ilq.0 for ; Thu, 21 Nov 2019 06:41:24 -0800 (PST) List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: guix-devel@gnu.org Hello Guix Developers. I am developing a project called MetaCall (https://github.com/metacall/core), which is a library that allows calling functions between programming languages. In short, it is a polyglot that allows importing code from other languages and using it as normal code. Since one year ago (or more), I have been trying to package it with no success. With Docker it has been relatively easily to do, but Docker is not a good way of distributing software like MetaCall. Because as it is a C/C++ project (and library), it should be able to be distributed for link against it as a shared or static library and not as a Docker image. One of the last attempts I have done is trying Guix, and it seems to be the definitive package system. With it I have achieved to package MetaCall with Python and generate a tarball with all dependencies self contained. This is a perfect solution to me, because I can distribute the complete polyglot with a single zip, allowing it to be installed in any distribution or any other package manager (npm, pip, nuget or gem). In order to achieve this I have developed a Docker image of Guix (https://github.com/metacall/guix) based on Alpine Linux. I work a lot with Docker because I am using MetaCall to build a FaaS (Function as a Service) (https://metacall.io), and Docker is a great tool nowadays in Cloud. So I my idea was to provide a Docker image of Guix to allow building MetaCall inside a CI/CD environment like Travis or any other well know managed CD/CI platform with free-tier. Current Guix Docker image is based on one of the latest version of Docker and it uses buildx, an extension of Docker that implements extra functionality by means of Buildkit. This is needed because this image needs to spawn new processes meanwhile it is being built, as Guix uses a daemon that does exactly this when running commands, so it required to provide that privilege. If you want to try the Docker image, just run: docker pull metacall/guix docker run -it metacall/guix /bin/sh And then you can run any command, or you can execute commands directly like this: docker run -it metacall/guix guix graph coreutils The store and profile folder can be shared too if you want to make it persistent in your PC and install programs there: docker run -v /gnu:/gnu -v $HOME/.guix-profile/:/root/.guix-profile/ -it metacall/guix guix package -i guile guile-cairo I hope it is useful for someone. I using it to build the complete polyglot with support for Python, Ruby, NodeJS, JavaScript (V8) and C# NetCore, which are the main supported languages and/or run-times (https://github.com/metacall/distributable/blob/53caad582cd097c5e92798bf0ec16660bfc4030c/source/metacall.scm). Although it is being difficult because MetaCall's build system is a bit complex and relies a lot in CMake features like ExternalProject (not allowed in Guix as it downloads during build time), I already achieved to build it with Python. You can take metacall/distributable as an example of how to use metacall/guix image. This will be eventually run in a CI/CD too. For building you only have to do is to run make. After building everything you will see a tarball-pack.tar.gz in the out directory outside of the container. Here is the build script: https://github.com/metacall/distributable/blob/53caad582cd097c5e92798bf0ec16660bfc4030c/scripts/build.sh . I will merge feature/guix-build into the master soon. Thanks for reading. Vicente.