Skip to content

Add git so that dart pub get works for pubspecs with git dependencies #26

@cpswan

Description

@cpswan

At present git isn't part of the base image or included in the Dockerfile template, so when a Dockerfile using FROM dart tries to run dart pub get the result is a sequence of:

Git command is not "git": Pub failed to run subprocess `git`: ProcessException: No such file or directory
  Command: git --version
Git command is not "git.cmd": Pub failed to run subprocess `git.cmd`: ProcessException: No such file or directory
  Command: git.cmd --version

This can be fixed by adding git to the apt-get section of the Dockerfile e.g.

RUN set -eux; \
    apt-get update; \
    apt-get install -y --no-install-recommends \
        ca-certificates \
        curl \
        openssh-client \
        unzip \
        dnsutils \
        git \
    ; \

The overall package diff (comparing apt list --installed between the existing dart image and one with git added) ends up being:

22a23,24
> git-man/now 1:2.20.1-2+deb10u3 all [installed,local]
> git/now 1:2.20.1-2+deb10u3 amd64 [installed,local]
41a44
> libcurl3-gnutls/now 7.64.0-4+deb10u2 amd64 [installed,local]
46a50,51
> liberror-perl/now 0.17027-2 all [installed,local]
> libexpat1/now 2.2.6-2+deb10u1 amd64 [installed,local]
52a58,59
> libgdbm-compat4/now 1.18.1-4 amd64 [installed,local]
> libgdbm6/now 1.18.1-4 amd64 [installed,local]
84a92
> libpcre2-8-0/now 10.32-5 amd64 [installed,local]
85a94
> libperl5.28/now 5.28.1-6+deb10u1 amd64 [installed,local]
117a127,128
> perl-modules-5.28/now 5.28.1-6+deb10u1 all [installed,local]
> perl/now 5.28.1-6+deb10u1 amd64 [installed,local]

resulting in an extra 76MB used by the raw image, which becomes 34MB when compressed on Docker Hub (for x64 arch).

Obviously people can workaround this by putting apt-get install -y git into their own Dockerfiles using FROM dart, and even create their own build images with git added. But as dart pub get is such a common thing to run, the various trade offs of image size, build times etc. would favour having a key ecosystem dependency like git in place.

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