Fix: Improve Dockerfiles and containerlab creation (especially in build and startup time)
This MR speeds up the build and start process for containerlab.
Description
Switched to docker's buildx, which allows caching the go dependencies from go build
and the usage of a .dockerignore
for each of our Dockerfiles. This reduces the size of our images and speeds up the built time.
Therefore deploying the containerlab is way quicker (and no new builds when deploying again without changes at the codebase, thanks to caching).
There was also a problem with go plugins built within the gosdn docker container, which resulted in them not being able to be loaded. Adding the -trimpath
flag to the built plugins and gosdn binary fixed this.
Related Issue
Motivation and Context
This MR solves the problems described in #229 (closed) and additionally fixes the plugin was built with a different version of package
... error within the gosdn's docker container. This allows us to use the containerlab again without waiting for 10 minutes to build.
How Has This Been Tested?
- Containerlab has been started successfully
- single containers could be built and started
- Tests still running
- Creation of device with plugins succeeded within gosdn container
Screenshots (if appropriate):
Types of changes
-
Bug fix (non-breaking change which fixes an issue) -
New feature (non-breaking change which adds functionality) -
Breaking change (fix or feature that would cause existing functionality to change)
Checklist:
-
My code follows the code style of this project. -
My change requires a change to the documentation. -
I have updated the documentation accordingly. -
I have read the CONTRIBUTING document. -
I have added tests to cover my changes. -
All new and existing tests passed.