Skip to content

Commit 3d7e2ea

Browse files
authored
Merge pull request #70 from xcube-dev/pont-55-dockerfile-image
Put the Dockerfile in the generated image
2 parents e372d9e + 287cc5c commit 3d7e2ea

File tree

3 files changed

+46
-1
lines changed

3 files changed

+46
-1
lines changed

CHANGES.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
* Improve handling of environment file specification (#63)
44
* Stop running container on SIGINT (#62)
55
* `xcetool image run --server` prints server and viewer URLs (#46)
6-
* Improve documentation (#54)
6+
* Improve documentation (#54, #55)
77
* Improve type annotations and checks (#68)
8+
* Include Dockerfile in built images (#55)
89

910
## Changes in 0.1.1
1011

docs/running-eoaps.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,49 @@
33
Application Packages are generally deployed to cloud platforms, but there are
44
also ways to run CWL files and complete Application Packages locally.
55

6+
## Understanding and debugging xcengine container images
7+
8+
### The base image
9+
10+
When generating a container image, xcengine uses a
11+
[micromamba](https://mamba.readthedocs.io/en/latest/user_guide/micromamba.html)
12+
image as a base. If you need to investigate or
13+
debug an xcengine image, or if you're just curious about its structure, you may
14+
find the [micromamba-docker
15+
documentation](https://micromamba-docker.readthedocs.io/) useful.
16+
17+
### Entry points
18+
19+
xcengine sets a custom entry point to run its own runner script, so any commands
20+
provided when running a container from an xcengine image with `docker run`
21+
will be applied as arguments to the xcengine runner. For instance, for an
22+
image tagged `myimage:1`, the `--server` parameter can be used like this:
23+
24+
`docker run myimage:1 --server`
25+
26+
This would run the xcengine runner script with the `--server` option, which
27+
starts an xcube server and viewer instance.
28+
29+
To explore or debug a container image, it's often useful to start a container
30+
with an interactive shell. To do this with an xcengine image, it's not enough
31+
to provide a path to a shell as a command, since this path will just be passed
32+
as a parameter to the xcengine runner script. You need to set the entry point
33+
as well, like this:
34+
35+
`docker --rm -it --entrypoint /usr/local/bin/_entrypoint.sh myimage:1 bash`
36+
37+
This resets the entry point to the usual micromamba-docker entry point, which
38+
sets up the Python environment, then runs bash within that environment.
39+
40+
### The Dockerfile and environment file
41+
42+
To aid reproducibility, the Dockerfile and environment file used to set up the
43+
container image are both included in the image itself, in the `/tmp`
44+
directory. The rest of the code and configuration for the image is in the
45+
`/home/mambauser` directory. In combination with the publicly available
46+
micromamba base image, each xcengine image thus contains the resources
47+
necessary to reproduce its own build process.
48+
649
## Running with cwltool
750

851
[cwltool](https://www.commonwl.org/user_guide/introduction/quick-start.html)

xcengine/core.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@ def _build_image(self) -> docker.models.images.Image:
302302
dockerfile = textwrap.dedent(
303303
"""
304304
FROM mambaorg/micromamba:1.5.10-noble-cuda-12.6.0
305+
COPY Dockerfile Dockerfile
305306
COPY environment.yml environment.yml
306307
RUN micromamba install -y -n base -f environment.yml && \
307308
micromamba clean --all --yes

0 commit comments

Comments
 (0)