[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: guix docker on gitlab-ci

From: wolf
Subject: Re: guix docker on gitlab-ci
Date: Mon, 29 May 2023 21:41:01 +0200

On 2023-05-24 18:04:47 +0100, Graham Addis wrote:
> Dear people,
> I tried to create a docker image to use in a gitlab-ci instance but it
> failed because I couldn't use --entry-point="bin/sh -l -c" or
> equivalent, basically the gitlab-runner complains that it can't run
> binaries.

Would this be better using just bin/sh for the entry point and passing the -l
and -c as an arguments?

> I've managed to get it working by making some changes to guix/scripts/pack.scm
> Adding a fn in docker-image, just before the call to
> build-docker-image, to create a list from the string passed in from
> --entry-point="bin/sh -l -c"
>             (define (make-docker-exec-form prefix value)
>               (cond
>                ((equal? value '())
>                 '())
>                ((equal? prefix '())
>                 (string-split value #\space))
>                (else
>                 (let ((values (string-split value #\space)))
>                   (cons
>                    (string-append prefix "/" (car values))
>                    (cdr values))))))

If I read this right (sorry, still somewhat new to guile), you basically split
the --entry-point argument on spaces and use those parts as separate values to
invoke, is that correct?  If so, how would you pass a binary that has space in
the name (joke example: `/bin/ba sh') into the entry-point?

> And replacing the setting of entry-point in the build-docker-image call to:
>                                 #:entry-point (make-docker-exec-form
> #$profile #$entry-point)
> The call to build-docker-image takes a list for entry-point, and it
> all works fine as far as I can tell.
> Before I send in a patch, some questions:
> Am I missing something?
> Am I on the right track?

In my opinion (which you are free to disagree with :) ), I think it would be
better to either have /bin/sh as an entry-point (and pass -l -c as arguments
when starting the container, if required) or create a wrapper script /bin/shlc
that would exec /bin/sh with correct arguments.

Few random ideas: Maybe the same format Containerfiles use for cmd and
entrypoint directives could be used?  Maybe the --entry-point could also (in
addition to a string) accept a list of strings (LISP list)?

> Should I be splitting this out before the call to docker-image?
> Thanks,
> Graham

There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.

Attachment: signature.asc
Description: PGP signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]