album-docker 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- album_docker-0.2.0/LICENSE +21 -0
- album_docker-0.2.0/PKG-INFO +89 -0
- album_docker-0.2.0/README.md +60 -0
- album_docker-0.2.0/setup.cfg +55 -0
- album_docker-0.2.0/setup.py +4 -0
- album_docker-0.2.0/src/album/__init__.py +4 -0
- album_docker-0.2.0/src/album/docker_plugin/__init__.py +1 -0
- album_docker-0.2.0/src/album/docker_plugin/argument_parsing.py +46 -0
- album_docker-0.2.0/src/album/docker_plugin/build_image.py +111 -0
- album_docker-0.2.0/src/album/docker_plugin/solution_entrypoint.sh +3 -0
- album_docker-0.2.0/src/album_docker.egg-info/PKG-INFO +89 -0
- album_docker-0.2.0/src/album_docker.egg-info/SOURCES.txt +15 -0
- album_docker-0.2.0/src/album_docker.egg-info/dependency_links.txt +1 -0
- album_docker-0.2.0/src/album_docker.egg-info/entry_points.txt +2 -0
- album_docker-0.2.0/src/album_docker.egg-info/requires.txt +2 -0
- album_docker-0.2.0/src/album_docker.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021, album developers.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: album_docker
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: album plugin for building docker images from solutions
|
|
5
|
+
Home-page: https://gitlab.com/album-app/plugins/album-docker
|
|
6
|
+
Author: Lucas Rieckert, Jan Philipp Albrecht, Deborah Schmidt
|
|
7
|
+
Maintainer: Lucas Rieckert, Jan Philipp Albrecht, Deborah Schmidt
|
|
8
|
+
Maintainer-email: album@kyleharrington.com
|
|
9
|
+
License: MIT
|
|
10
|
+
Project-URL: Source, https://gitlab.com/album-app/plugins/album-docker
|
|
11
|
+
Project-URL: Tracker, https://gitlab.com/album-app/album/issues
|
|
12
|
+
Keywords: virtual,environments,imaging,data analysis
|
|
13
|
+
Platform: any
|
|
14
|
+
Classifier: Development Status :: 3 - Alpha
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Operating System :: MacOS :: MacOS X
|
|
17
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
18
|
+
Classifier: Operating System :: POSIX
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
21
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
22
|
+
Classifier: Topic :: Utilities
|
|
23
|
+
Requires-Python: >=3.7
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Requires-Dist: album<0.13.0,>=0.11.0
|
|
27
|
+
Requires-Dist: docker
|
|
28
|
+
Dynamic: license-file
|
|
29
|
+
|
|
30
|
+
# Album plugin for creating Docker images from solutions
|
|
31
|
+
|
|
32
|
+
Plugin for creating Docker images from Album solutions.
|
|
33
|
+
|
|
34
|
+
The plugin allows you to package an Album solution into a Docker image, which can then be used to run the solution in a containerized environment,
|
|
35
|
+
containing all necessary dependencies and configurations.
|
|
36
|
+
Behavior of the container will be similar to the `album run` command, but the solution will be installed in a
|
|
37
|
+
Docker image instead of the local environment.
|
|
38
|
+
This is particularly useful for ensuring that the solution runs with all its dependencies in a consistent environment.
|
|
39
|
+
|
|
40
|
+
## Installation:
|
|
41
|
+
|
|
42
|
+
1. [Install Album](https://docs.album.solutions/en/latest/installation-instructions.html#)
|
|
43
|
+
2. Activate the album environment:
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
conda activate album
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
3. Install the album docker plugin:
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
pip install album-docker
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Usage:
|
|
56
|
+
|
|
57
|
+
To create a docker image which contains Album with the passed solution installed run following command:
|
|
58
|
+
|
|
59
|
+
If your solution is in a directory, you can copy the solution.py file into a new folder, e.g. `mySolutionFolder`, and then run the command from that folder.
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
mkdir mySolutionFolder
|
|
63
|
+
cp /path/to/your/solution.py mySolutionFolder/
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Then run the following command to create the docker image:
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
album docker --solution mySolutionFolder --output_path /your/output/path
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
The outcome will be a docker image with the tag `<group>:<name>:<version>` of the solution, where `<group>`, `<name>`, and `<version>` are defined in the solution.py file.
|
|
74
|
+
|
|
75
|
+
### Input parameter:
|
|
76
|
+
|
|
77
|
+
- solution: The album solution which should be packed into an executable.
|
|
78
|
+
- output_path: The path where the executable should be saved
|
|
79
|
+
- install-flags: Flags to pass to the album install command, e.g. '--allow-recursive'.
|
|
80
|
+
- install-deps: Dependencies to install in the docker image, e.g. 'gxx' or 'gxx cmake'. This line will be added to the Dockerfile as a RUN command, so you can use any command that is valid in a Dockerfile.
|
|
81
|
+
|
|
82
|
+
## Example:
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
album docker --solution mySolutionFolder --output_path /your/output/path --install-flags="--allow-recursive" --install-deps="apt update && apt install -y gxx cmake"
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
This will create a docker image with the tag <group:name:version> of the solution.
|
|
89
|
+
Inside the image, the solution is installed together with the dependencies gxx and cmake.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Album plugin for creating Docker images from solutions
|
|
2
|
+
|
|
3
|
+
Plugin for creating Docker images from Album solutions.
|
|
4
|
+
|
|
5
|
+
The plugin allows you to package an Album solution into a Docker image, which can then be used to run the solution in a containerized environment,
|
|
6
|
+
containing all necessary dependencies and configurations.
|
|
7
|
+
Behavior of the container will be similar to the `album run` command, but the solution will be installed in a
|
|
8
|
+
Docker image instead of the local environment.
|
|
9
|
+
This is particularly useful for ensuring that the solution runs with all its dependencies in a consistent environment.
|
|
10
|
+
|
|
11
|
+
## Installation:
|
|
12
|
+
|
|
13
|
+
1. [Install Album](https://docs.album.solutions/en/latest/installation-instructions.html#)
|
|
14
|
+
2. Activate the album environment:
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
conda activate album
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
3. Install the album docker plugin:
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
pip install album-docker
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Usage:
|
|
27
|
+
|
|
28
|
+
To create a docker image which contains Album with the passed solution installed run following command:
|
|
29
|
+
|
|
30
|
+
If your solution is in a directory, you can copy the solution.py file into a new folder, e.g. `mySolutionFolder`, and then run the command from that folder.
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
mkdir mySolutionFolder
|
|
34
|
+
cp /path/to/your/solution.py mySolutionFolder/
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Then run the following command to create the docker image:
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
album docker --solution mySolutionFolder --output_path /your/output/path
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The outcome will be a docker image with the tag `<group>:<name>:<version>` of the solution, where `<group>`, `<name>`, and `<version>` are defined in the solution.py file.
|
|
45
|
+
|
|
46
|
+
### Input parameter:
|
|
47
|
+
|
|
48
|
+
- solution: The album solution which should be packed into an executable.
|
|
49
|
+
- output_path: The path where the executable should be saved
|
|
50
|
+
- install-flags: Flags to pass to the album install command, e.g. '--allow-recursive'.
|
|
51
|
+
- install-deps: Dependencies to install in the docker image, e.g. 'gxx' or 'gxx cmake'. This line will be added to the Dockerfile as a RUN command, so you can use any command that is valid in a Dockerfile.
|
|
52
|
+
|
|
53
|
+
## Example:
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
album docker --solution mySolutionFolder --output_path /your/output/path --install-flags="--allow-recursive" --install-deps="apt update && apt install -y gxx cmake"
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
This will create a docker image with the tag <group:name:version> of the solution.
|
|
60
|
+
Inside the image, the solution is installed together with the dependencies gxx and cmake.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
[metadata]
|
|
2
|
+
name = album_docker
|
|
3
|
+
version = 0.2.0
|
|
4
|
+
description = album plugin for building docker images from solutions
|
|
5
|
+
long_description = file: README.md
|
|
6
|
+
long_description_content_type = text/markdown
|
|
7
|
+
url = https://gitlab.com/album-app/plugins/album-docker
|
|
8
|
+
author = Lucas Rieckert, Jan Philipp Albrecht, Deborah Schmidt
|
|
9
|
+
maintainer = Lucas Rieckert, Jan Philipp Albrecht, Deborah Schmidt
|
|
10
|
+
maintainer_email = album@kyleharrington.com
|
|
11
|
+
license = MIT
|
|
12
|
+
license_file = LICENSE
|
|
13
|
+
platforms = any
|
|
14
|
+
classifiers =
|
|
15
|
+
Development Status :: 3 - Alpha
|
|
16
|
+
License :: OSI Approved :: MIT License
|
|
17
|
+
Operating System :: MacOS :: MacOS X
|
|
18
|
+
Operating System :: Microsoft :: Windows
|
|
19
|
+
Operating System :: POSIX
|
|
20
|
+
Programming Language :: Python :: 3.8
|
|
21
|
+
Programming Language :: Python :: 3.9
|
|
22
|
+
Programming Language :: Python :: Implementation :: PyPy
|
|
23
|
+
Topic :: Utilities
|
|
24
|
+
keywords = virtual, environments, imaging, data analysis
|
|
25
|
+
project_urls =
|
|
26
|
+
Source=https://gitlab.com/album-app/plugins/album-docker
|
|
27
|
+
Tracker=https://gitlab.com/album-app/album/issues
|
|
28
|
+
|
|
29
|
+
[options]
|
|
30
|
+
package_dir =
|
|
31
|
+
=src
|
|
32
|
+
packages = find_namespace:
|
|
33
|
+
include_package_data = True
|
|
34
|
+
install_requires =
|
|
35
|
+
album>=0.11.0,<0.13.0
|
|
36
|
+
docker
|
|
37
|
+
python_requires = >=3.7
|
|
38
|
+
|
|
39
|
+
[options.package_data]
|
|
40
|
+
* = *.txt, *.rst, *.sh, *.sql, *.json
|
|
41
|
+
|
|
42
|
+
[options.packages.find]
|
|
43
|
+
where = src
|
|
44
|
+
|
|
45
|
+
[options.entry_points]
|
|
46
|
+
console_parsers_album =
|
|
47
|
+
docker=album.docker_plugin.argument_parsing:create_docker_parser
|
|
48
|
+
|
|
49
|
+
[flake8]
|
|
50
|
+
max-line-length = 120
|
|
51
|
+
|
|
52
|
+
[egg_info]
|
|
53
|
+
tag_build =
|
|
54
|
+
tag_date = 0
|
|
55
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Docker plugin for Album."""
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"""Album Docker Plugin Argument Parsing Module."""
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
|
|
4
|
+
from album.api import Album
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def album_docker(album_instance: Album, args):
|
|
8
|
+
"""Launch the building of a Docker image from the input solution."""
|
|
9
|
+
from album.docker_plugin.build_image import run
|
|
10
|
+
|
|
11
|
+
run(album_instance, args)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def create_docker_parser(parser):
|
|
15
|
+
"""Create the argument parser for the Docker plugin."""
|
|
16
|
+
p = parser.create_command_parser(
|
|
17
|
+
"docker",
|
|
18
|
+
album_docker,
|
|
19
|
+
"Launch the building of a docker image from the input solution.",
|
|
20
|
+
)
|
|
21
|
+
p.add_argument(
|
|
22
|
+
"--solution",
|
|
23
|
+
type=str,
|
|
24
|
+
help="Path for the solution file or coordinates of the solution (group:name:version)",
|
|
25
|
+
)
|
|
26
|
+
p.add_argument(
|
|
27
|
+
"--output",
|
|
28
|
+
type=str,
|
|
29
|
+
required=True,
|
|
30
|
+
default=str(Path.home()),
|
|
31
|
+
help="The path where the build image should be saved",
|
|
32
|
+
)
|
|
33
|
+
p.add_argument(
|
|
34
|
+
"--install-flags",
|
|
35
|
+
type=str,
|
|
36
|
+
default="",
|
|
37
|
+
required=False,
|
|
38
|
+
help="Flags to pass to the solution install command",
|
|
39
|
+
)
|
|
40
|
+
p.add_argument(
|
|
41
|
+
"--install-deps",
|
|
42
|
+
type=str,
|
|
43
|
+
default="",
|
|
44
|
+
required=False,
|
|
45
|
+
help="Dependencies to install in the docker image, e.g. 'gxx' or 'gxx cmake'",
|
|
46
|
+
)
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"""Module to build a Docker image for an Album solution."""
|
|
2
|
+
import shutil
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from tempfile import TemporaryDirectory
|
|
5
|
+
|
|
6
|
+
import docker
|
|
7
|
+
|
|
8
|
+
import album.core.model.default_values
|
|
9
|
+
from album.api import Album
|
|
10
|
+
from album.runner.album_logging import get_active_logger
|
|
11
|
+
|
|
12
|
+
CUR_DIR = Path(__file__).parent
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def create_dockerfile(output_path, install_deps=None, install_flags=None):
|
|
16
|
+
"""Create a Dockerfile for the Album solution."""
|
|
17
|
+
if install_flags is None:
|
|
18
|
+
install_flags = ""
|
|
19
|
+
if install_deps is not None and install_deps != "":
|
|
20
|
+
install_deps = "RUN %s" % install_deps
|
|
21
|
+
dockerfile_str = f"""FROM albumsolutions/album:{album.core.__version__}
|
|
22
|
+
COPY . /solution
|
|
23
|
+
SHELL ["/bin/bash", "-l", "-c"]
|
|
24
|
+
RUN chmod +x /solution/solution_entrypoint.sh
|
|
25
|
+
RUN apt update
|
|
26
|
+
RUN apt install -y dos2unix
|
|
27
|
+
RUN dos2unix /solution/solution_entrypoint.sh
|
|
28
|
+
{install_deps}
|
|
29
|
+
RUN album install {install_flags} /solution
|
|
30
|
+
ENTRYPOINT ["./solution/solution_entrypoint.sh"]
|
|
31
|
+
"""
|
|
32
|
+
dockerfile_path = Path(output_path).joinpath("Dockerfile")
|
|
33
|
+
with open(dockerfile_path, "w") as file:
|
|
34
|
+
file.write(dockerfile_str)
|
|
35
|
+
return dockerfile_path
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def build_image(coordinates, context, output):
|
|
39
|
+
"""Build a Docker image from the given context and save it to the output directory."""
|
|
40
|
+
coordinates = str(coordinates).replace(":", "_").lower()
|
|
41
|
+
image_tar_name = "%s_image.tar" % coordinates
|
|
42
|
+
client = docker.from_env(timeout=1200)
|
|
43
|
+
image, build_output = client.images.build(path=context, tag=coordinates, rm=True)
|
|
44
|
+
|
|
45
|
+
for chunk in build_output:
|
|
46
|
+
if "stream" in chunk:
|
|
47
|
+
get_active_logger().info(chunk["stream"].strip())
|
|
48
|
+
elif "error" in chunk:
|
|
49
|
+
get_active_logger().error(chunk["error"].strip())
|
|
50
|
+
|
|
51
|
+
with open(Path(output).joinpath(image_tar_name), "wb") as file:
|
|
52
|
+
for chunk in image.save():
|
|
53
|
+
file.write(chunk)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def get_solution_info(album_instance: Album, solution):
|
|
57
|
+
"""Get the solution path and coordinates from the Album instance."""
|
|
58
|
+
if not Path(solution).exists():
|
|
59
|
+
path = album_instance.resolve(str(solution)).path()
|
|
60
|
+
else:
|
|
61
|
+
path = solution
|
|
62
|
+
coordinates = album_instance.resolve(str(solution)).coordinates()
|
|
63
|
+
return path, coordinates
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def copy_to_context(src, target):
|
|
67
|
+
"""Copy the solution files to the Docker build context."""
|
|
68
|
+
if Path(src).is_dir():
|
|
69
|
+
for file in Path(src).glob("*"):
|
|
70
|
+
if Path(file).is_file():
|
|
71
|
+
shutil.copy(Path(file), target)
|
|
72
|
+
else:
|
|
73
|
+
shutil.copytree(Path(file), Path(target).joinpath(Path(file).name))
|
|
74
|
+
else:
|
|
75
|
+
shutil.copy(src, target)
|
|
76
|
+
|
|
77
|
+
# copy solution_entrypoint.sh to target
|
|
78
|
+
entrypoint_script = CUR_DIR.joinpath("solution_entrypoint.sh")
|
|
79
|
+
if entrypoint_script.exists():
|
|
80
|
+
shutil.copy(entrypoint_script, target)
|
|
81
|
+
else:
|
|
82
|
+
get_active_logger().error("solution_entrypoint.sh not found in %s" % CUR_DIR)
|
|
83
|
+
raise FileNotFoundError("solution_entrypoint.sh not found in %s" % CUR_DIR)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def run(album_instance: Album, args):
|
|
87
|
+
"""Run the Docker image build process for the given Album solution."""
|
|
88
|
+
if not (Path(args.output).exists()):
|
|
89
|
+
Path(args.output).mkdir()
|
|
90
|
+
|
|
91
|
+
solution_path, coordinates = get_solution_info(album_instance, args.solution)
|
|
92
|
+
|
|
93
|
+
get_active_logger().info("Building an docker image which runs the solution.")
|
|
94
|
+
get_active_logger().info(f"solution: {coordinates} at {solution_path}")
|
|
95
|
+
get_active_logger().info("output directory: %s" % args.output)
|
|
96
|
+
get_active_logger().info("Using install flags: %s" % args.install_flags)
|
|
97
|
+
get_active_logger().info("Using install dependencies: %s" % args.install_deps)
|
|
98
|
+
get_active_logger().info(
|
|
99
|
+
"This may take a while. Logs will be printed after the build is finished. Please be patient."
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
with TemporaryDirectory() as tmpdir:
|
|
103
|
+
get_active_logger().debug("Temporary directory for docker build: %s" % tmpdir)
|
|
104
|
+
copy_to_context(solution_path, Path(tmpdir))
|
|
105
|
+
get_active_logger().debug(
|
|
106
|
+
"Copied solution %s to temporary directory." % solution_path
|
|
107
|
+
)
|
|
108
|
+
create_dockerfile(Path(tmpdir), args.install_deps, args.install_flags)
|
|
109
|
+
get_active_logger().debug("Created Dockerfile in temporary directory.")
|
|
110
|
+
build_image(coordinates, tmpdir, args.output)
|
|
111
|
+
get_active_logger().info("Docker image built successfully.")
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: album_docker
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: album plugin for building docker images from solutions
|
|
5
|
+
Home-page: https://gitlab.com/album-app/plugins/album-docker
|
|
6
|
+
Author: Lucas Rieckert, Jan Philipp Albrecht, Deborah Schmidt
|
|
7
|
+
Maintainer: Lucas Rieckert, Jan Philipp Albrecht, Deborah Schmidt
|
|
8
|
+
Maintainer-email: album@kyleharrington.com
|
|
9
|
+
License: MIT
|
|
10
|
+
Project-URL: Source, https://gitlab.com/album-app/plugins/album-docker
|
|
11
|
+
Project-URL: Tracker, https://gitlab.com/album-app/album/issues
|
|
12
|
+
Keywords: virtual,environments,imaging,data analysis
|
|
13
|
+
Platform: any
|
|
14
|
+
Classifier: Development Status :: 3 - Alpha
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Operating System :: MacOS :: MacOS X
|
|
17
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
18
|
+
Classifier: Operating System :: POSIX
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
21
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
22
|
+
Classifier: Topic :: Utilities
|
|
23
|
+
Requires-Python: >=3.7
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Requires-Dist: album<0.13.0,>=0.11.0
|
|
27
|
+
Requires-Dist: docker
|
|
28
|
+
Dynamic: license-file
|
|
29
|
+
|
|
30
|
+
# Album plugin for creating Docker images from solutions
|
|
31
|
+
|
|
32
|
+
Plugin for creating Docker images from Album solutions.
|
|
33
|
+
|
|
34
|
+
The plugin allows you to package an Album solution into a Docker image, which can then be used to run the solution in a containerized environment,
|
|
35
|
+
containing all necessary dependencies and configurations.
|
|
36
|
+
Behavior of the container will be similar to the `album run` command, but the solution will be installed in a
|
|
37
|
+
Docker image instead of the local environment.
|
|
38
|
+
This is particularly useful for ensuring that the solution runs with all its dependencies in a consistent environment.
|
|
39
|
+
|
|
40
|
+
## Installation:
|
|
41
|
+
|
|
42
|
+
1. [Install Album](https://docs.album.solutions/en/latest/installation-instructions.html#)
|
|
43
|
+
2. Activate the album environment:
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
conda activate album
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
3. Install the album docker plugin:
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
pip install album-docker
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Usage:
|
|
56
|
+
|
|
57
|
+
To create a docker image which contains Album with the passed solution installed run following command:
|
|
58
|
+
|
|
59
|
+
If your solution is in a directory, you can copy the solution.py file into a new folder, e.g. `mySolutionFolder`, and then run the command from that folder.
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
mkdir mySolutionFolder
|
|
63
|
+
cp /path/to/your/solution.py mySolutionFolder/
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Then run the following command to create the docker image:
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
album docker --solution mySolutionFolder --output_path /your/output/path
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
The outcome will be a docker image with the tag `<group>:<name>:<version>` of the solution, where `<group>`, `<name>`, and `<version>` are defined in the solution.py file.
|
|
74
|
+
|
|
75
|
+
### Input parameter:
|
|
76
|
+
|
|
77
|
+
- solution: The album solution which should be packed into an executable.
|
|
78
|
+
- output_path: The path where the executable should be saved
|
|
79
|
+
- install-flags: Flags to pass to the album install command, e.g. '--allow-recursive'.
|
|
80
|
+
- install-deps: Dependencies to install in the docker image, e.g. 'gxx' or 'gxx cmake'. This line will be added to the Dockerfile as a RUN command, so you can use any command that is valid in a Dockerfile.
|
|
81
|
+
|
|
82
|
+
## Example:
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
album docker --solution mySolutionFolder --output_path /your/output/path --install-flags="--allow-recursive" --install-deps="apt update && apt install -y gxx cmake"
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
This will create a docker image with the tag <group:name:version> of the solution.
|
|
89
|
+
Inside the image, the solution is installed together with the dependencies gxx and cmake.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
setup.cfg
|
|
4
|
+
setup.py
|
|
5
|
+
src/album/__init__.py
|
|
6
|
+
src/album/docker_plugin/__init__.py
|
|
7
|
+
src/album/docker_plugin/argument_parsing.py
|
|
8
|
+
src/album/docker_plugin/build_image.py
|
|
9
|
+
src/album/docker_plugin/solution_entrypoint.sh
|
|
10
|
+
src/album_docker.egg-info/PKG-INFO
|
|
11
|
+
src/album_docker.egg-info/SOURCES.txt
|
|
12
|
+
src/album_docker.egg-info/dependency_links.txt
|
|
13
|
+
src/album_docker.egg-info/entry_points.txt
|
|
14
|
+
src/album_docker.egg-info/requires.txt
|
|
15
|
+
src/album_docker.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
album
|