scripts/docker-teambit-bit/README.md
This dockers are not dealing with legacy bit (pre-harmony) for legacy bit please refer to bit-docker
Dockerfile-bit (using from) which creates a bare scope, and initializes the bit server on it (bit start)The docker images hosted on Dockerhub on those links Dockerfile-bit and Dockerfile-bit-server
cd scripts/docker-teambit-bitdocker build -f ./Dockerfile-bit -t bitcli/bit:latest .docker build -f ./Dockerfile-bit-server -t bitcli/bit-server:latest .docker run -it bitcli/bit:latest /bin/bashbit -v to see bit's version to make sure it worksdocker run -it -p {host-port}:3000 bitcli/bit-server:latest - replace the host port with the port you want to use on your host machine, for example 5000http://localhost:{host-port} and make sure you see the bit's uibit remote add http://localhost:{host-port} you should get a message saying remote-scope was addedremote-scope on your workspace.jsonc as defaultScopebit exportBit server is getting a BIT_VERSION argument which is used in the FROM statement. You can use it with docker build -f ./Dockerfile-bit-server --build-arg BIT_VERSION={version} -t bitcli/bit-server:{version} .
This will make your server to fetch the cli container from Dockerhub with the specified version
The scope name is defined by the folder name of the containing scope (remote-scope by default).
This name is then later used for setting it up in the workspace.jsonc file.
In case you want to change it you can pass the build arg called SCOPE_PATH like --build-arg SCOPE_PATH=/root/custom-remote-scope
In order to persist the scope data, you want the scope folder to live outside the container in the host machine.
You can use bind mounts to do so:
docker run -it -v {scope-path-on-host}:/root/remote-scope -p {host-port}:3000 bitcli/bit-server:latest
Usually it's better to use volumes than bind mounts, or even handle the mounts by an orchestrator like Kubernetes but this topics is out of the scope in this guide
When combining change of the scope name/location and volume you have to make sure the location provided in the SCOPE_PATH in the build arg is matching the target in the volume:
docker run -it -v {scope-path-on-host}:/root/custom-remote-scope -build-arg SCOPE_PATH=/root/custom-remote-scope -p {host-port}:3000 bitcli/bit-server:latest
See the /root/custom-remote-scope is used both in the -v arg after the : and as the SCOPE_PATH value.
Since the bit start command at the moment can't be run as detached, you will need a way to run it as the main command and to monitor the logs at the same time.
In order to do so, we will connect the logs dir on the container to a dir in the host using bind mounts.
In order to watch the bit logs, you will need to mount the logs directory in the host machine. like this:
docker run -it -v {logs-dir-on-host}:/root/Library/Caches/Bit/logs -p {host-port}:3000 bitcli/bit-server:latest
An example with actual values (use /root/bit-server-docker-logs for logs on host and port 5000 on host):
docker run -it -v /root/bit-server-docker-logs:/root/Library/Caches/Bit/logs -p 5000:3000 bitcli/bit-server:latest
In most cases it make sense to use tmpfs-mounts for this, but this as well is out of the scope for this guide
NODE_OPTIONS=--max_old_space_size=4096). For example in mac - docker for mac resources