docker: help install tar-split (create Dockerfile to make a binary of tar-split

parent fe214a69
......@@ -11,3 +11,4 @@ env
.mypy_cache
**/.pytest_cache/
doc/build
tar-split
......@@ -16,7 +16,7 @@
- [zeroconf](https://pypi.python.org/pypi/zeroconf) (for local node discovery)
- [click](https://pypi.python.org/pypi/click) (for cli options, commands)
## Docker Setteings
## Docker Settings
### Install Docker
......@@ -57,6 +57,23 @@ Storage Driver: overlay2
...
```
### Install tar-split
beiran's docker plugin needs [tar-split](https://github.com/vbatts/tar-split) now. Please create the binary file and set `tar_split_path`;
```
$ go get github.com/vbatts/tar-split
$ export BEIRAN_PACKAGE_DOCKER_CONFIG='tar_split_path=path/to/tar-split'
```
Or, copy the binary file to the plugin directory (deafult `tar-split_path` is there)
```
$ go get github.com/vbatts/tar-split
$ cp path/to/tar-split plugins/beiran_package_docker/
```
## Virtualenv
### - Setup
......
......@@ -73,6 +73,14 @@ export BEIRAN_DB_FILE=${DIR}/beiran.db
export BEIRAN_LISTEN_ADDRESS=0.0.0.0
export BEIRAN_CONFIG_DIR=${DIR}
# make binary of 'tar-split' with Docker
tarsplit_dir=${DIR}/plugins/beiran_package_docker/
if [ ! -e ${tarsplit_dir}/tar-split ]; then
docker build -t tarsplit -f $tarsplit_dir/DockerfileTarsplit $tarsplit_dir
docker create --name tarsplit tarsplit && docker cp tarsplit:/tar-split ${tarsplit_dir}/tar-split && docker rm tarsplit && docker rmi tarsplit
fi
function ps1_context {
# For any of these bits of context that exist, display them and append
# a space.
......
FROM golang:1.11.5-alpine3.9
LABEL maintainer="info@beiran.io"
RUN apk add git && go get -d github.com/vbatts/tar-split/cmd/tar-split && \
CGO_ENABLED=0 go build -o /tar-split /go/src/github.com/vbatts/tar-split/cmd/tar-split
......@@ -59,6 +59,7 @@ class DockerPackaging(BasePackagePlugin): # pylint: disable=too-many-instance-a
def set_dynamic_defaults(self):
"""Set dynamic configuration value like using ``run_dir``"""
self.config.setdefault('cache_dir', config.cache_dir + '/docker')
self.config.setdefault('tar_split_path', os.path.dirname(__file__) + '/tar-split')
async def init(self):
self.aiodocker = Docker()
......
......@@ -1175,7 +1175,7 @@ class DockerUtil: # pylint: disable=too-many-instance-attributes
output_file = os.path.join(self.layer_tar_path, del_idpref(diff_id) + '.tar')
cmd = "tar-split asm --input " + input_file + " --path " + relative_path + \
cmd = self.config['tar_split_path'] + " asm --input " + input_file + " --path " + relative_path + \
" --output " + output_file
with open('/dev/null', 'w') as devnull:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment