Add DCli to a Docker Container
Adding DCli to your Dockerfile
You can add DCli to your own Dockerfile. This will allow you to run DCli scripts as part of the Docker deployment process as well as running DCli scripts within the final docker container.
DCli is installed into the root user (as is normal for a Docker container). Installers exist for Linux, Windows and Mac OSX.
Just change the wget path to obtain the correct installer:
Linux path
Compiling a dart package
Now you have dart and dcli in your container you will want to import a project and compile it.
Upgrading DCli in your docker image.
After building your docker image you may need to force an upgrade of the DCli version.
You can simply recreate your docker image or to save time you can just up use this one trick (sorry) to force docker to just rebuild the DCli install (and subsequent steps in your docker file).
Add the following line just before the call to wget.
If you want to force an upgrade of DCli just increment the no. and run docker build.
Using the DCli docker image
A Docker image is available which can be used to create a DCli CLI on your system without polluting your OS.
The docker container presents a CLI with dart and DCli pre-installed so you can experiment with DCli or deploy DCli to system instances.
To use the container:
Create a volume so that your scripts are persistent:
Attach to the DCli cli.
The volume is mounted to /home/scripts
within your dcli container.
vi is included in the container.
Alternatively you can install and run dcli directly from your cli.
git based dependencies
dart allows you to include dependencies which are pulled from a git repo.
e.g.
If your git repository is public then you don't need to do anything special.
If your git repository is private then calling pub get
or attempting a dcli compile
will fail with an auth error.
If this is your scenario then you may need to make your .ssh keys available to the docker build.
This blog article provide a details on how to achieve this.
http://blog.oddbit.com/post/2019-02-24-docker-build-learns-about-secr/
The shorter summary is:
With in your docker file your FIRST line MUST be:
Alpine
If you are using an Alpine based Docker image then you will need to install gclibc.
WARNING: There appear to be some issues around using alpine. I'm seeing network errors (error 69) running pub get. These generally happen toward the end of the process but occur about 80% of the time. You can reproduce them easily by running pub cache repair
. My suspicion is that its because we are installing glibc when alpine uses mu libc.
Last updated