diff --git a/book/configuration_files.qmd b/book/configuration_files.qmd index f51e21f..d63bdc2 100644 --- a/book/configuration_files.qmd +++ b/book/configuration_files.qmd @@ -1,10 +1,15 @@ # Configuration files -The presence of these files will trigger the following behavior. Do not use these names if you do not want this behavior and you instead want -to write you own code in your Docker file. - ## environment.yml +The `install-conda-packages.sh` script will install conda packages to the conda notebook environment, the user environment in the py-rocket-base image (same as for pangeo and repo2docker images). + +Here is the code for your Docker file. You can name the conda package file to something other than `environment.yml`. Make sure your file has `name:`. The name is arbitrary. It is ignored but required for the script. + +``` +RUN /pyrocket_scripts/install-conda-packages.sh environment.yml +``` + This is a standard format. You can add version pinning. environment.yml @@ -17,8 +22,40 @@ dependencies: - numpy ``` +## conda-lock.yml + +Instead of a list of conda packages (typically called environment.yml), you can use a conda lock file instead. + +Here is the code for your Docker file. You can name your conda lock file something other than `conda-lock.yml`. +``` +RUN /pyrocket_scripts/install-conda-packages.sh conda-lock.yml +``` + +## requirments.txt + +The `install-pip-packages.sh` script will install packages using `pip`. Here is the code for your Docker file. You can name your pip package file something other than `requirements.txt`. + +``` +RUN /pyrocket_scripts/install-pip-packages.sh requirements.txt +``` + +requirements.txt +``` +#a package +harmony-py + +``` + ## install.R +The `install-r-packages.sh` script will run the supplied R script which you can use to install R packages to the system library. + +Here is the code for your Docker file. You can name the R script file to something other than `install.R`. Make sure your file is an R script. + +``` +RUN /pyrocket_scripts/install-r-packages.sh install.R +``` + install.R example ``` # to match rocker/verse:4.4 used in py-rocker-base @@ -30,20 +67,29 @@ install.packages(list.of.packages, repos=repo) ### Add R geospatial packages -Geospatial packages require some linux packages. To get this working in your docker image add this to your Docker file: +Geospatial packages require some linux packages. To get this working in your Docker image add this to your Docker file: +Dockerfile ``` FROM ghcr.io/nmfs-opensci/py-rocket-base:latest USER root -RUN /rocker_scripts/install_geospatial.sh -USER ${NB_USER} +RUN PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin && \ + /rocker_scripts/install_geospatial.sh +USER ${NB_USER} ``` ## apt.txt -Standard format. You can have comments. +The `install-apt-packages.sh` script will install packages with `apt-get`. Here is the code for your Docker file. You can name the apt file of packages names to something other than `apt.txt`. Comments and newlines are allowed. Installation requires root. +``` +USER root +RUN /pyrocket_scripts/install-apt-packages.sh apt.txt +USER ${NB_USER} +``` + +apt.txt example ``` # Some useful stuff tk-dev @@ -54,7 +100,11 @@ cmocean ## postBuild -This is a script that will be run after all the other commands. This script is run as jovyan not as root. If you need commands run as root, you will need to add these to the Docker file. +The `run-postbuild.sh` script can be run as root or jovyan (`${NB_USER}`). This script does not accept a file name. You need to name your postBuild script `postBuild` and put at the base level with your Docker file. + +``` +RUN /pyrocket_scripts/run-postbuild.sh +``` postBuild ``` @@ -66,10 +116,13 @@ set -e ## start -`start` bash code is run when the image starts. py-rocker-base has a start script at `${REPO_DIR}/start` which loads the Desktop applications. If you change that start file, then the Desktop apps will not be loaded properly. +The `start` bash code is run when the image starts. py-rocker-base has a start script at `${REPO_DIR}/start` which loads the Desktop applications. If you change that start file (by copying your start file onto that location), then the Desktop apps will not be loaded properly. Instead, the `setup-start.sh` will add your start file to the end of `${REPO_DIR}/start` so that the Desktop is still setup properly. -By default, if you include `start` in the child repo then that script is sourced within the `${REPO_DIR}/start` script at the end. If you don't want that behavior and want the whole start script replaced, then you will need to do that in your Docker file by copying your start file onto `${REPO_DIR}/start`. +The `setup-start.sh` script does not accept a file name. You need to name your start script `start` and put at the base level with your Docker file. +``` +RUN /pyrocket_scripts/setup-start.sh +``` ## Desktop applications diff --git a/book/customizing.qmd b/book/customizing.qmd index 3a9032b..ba05a4b 100644 --- a/book/customizing.qmd +++ b/book/customizing.qmd @@ -1,19 +1,25 @@ # Using py-rocket-base -py-rocket-base is designed to be used in the FROM line of a Dockerfile. It behaves like repo2docker in that it looks for special files and will -install Python packages or R packages if those special files are present. You do not need to add anything to the Dockerfile to have it process these files. py-rocker-base does this automatically for you (via ONBUILD commands). +py-rocket-base is designed to be used in the FROM line of a Dockerfile similar to rocker images. It includes directories called `\pyrocket_scripts` and `\rocker_scripts` that will help you do common tasks for scientific docker images. You do not have to use these scripts. If you are familiar with writing Docker files, you can write your own code. The exception is installation of Desktop files. Properly adding Desktop applications to py-rocket-base requires the use of the `\pyrocket_scripts/install-desktop.sh` script. The start file is also an exception. See the discussion in the configuration files. -If you don't want it to do this then do not name your files one of these names: +**Calling the scripts** -- environment.yml -- install.R -- postBuild -- apt.txt -- start +The format for calling the pyrocket and rocker scripts is the following. +``` +RUN /pyrocket_scripts/install-conda-packages.sh environment.yml +``` + +Note that PATH must be given for the subshell since rocker installation scripts will fail with conda on the path. +``` +USER root +RUN PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin && \ + /rocker_scripts/install_geospatial.sh +USER ${NB_USER} +``` ## File structure -Only Dockerfile is required. The rest are optional. +Here is a typical repo structure. Only the Dockerfile is required. The rest are optional. The files names, `apt.txt`, `environment.yml`, `requirements.txt` and `install.R` are optional. You can name these files other names and still use them in the pyrocket scripts. `Desktop`, `start` and `postBuild` must be named exactly this to use them in the pyrocket scripts (these scripts do not take filename arguments). ``` your-repo/ @@ -21,6 +27,7 @@ your-repo/ ├── apt.txt ├── environment.yml ├── install.R +├── requirements.txt ├── postBuild ├── start ├── Desktop/ @@ -29,7 +36,7 @@ your-repo/ │ └── qgis.png ``` -Read [configuration_files](configuration_files.html) to learn about apt.txt, environment.yml, install.R, postBuild, and start. Read [Desktop](desktop.html) to learn about the Desktop folder and files for applications. +Read [configuration_files](configuration_files.html) to learn about apt.txt, environment.yml, install.R, requirements.txt, postBuild, and start. Read [Desktop](desktop.html) to learn about the Desktop folder and files for applications. ## Examples @@ -46,6 +53,8 @@ your-repo/ Dockerfile ``` FROM ghcr.io/nmfs-opensci/py-rocket-base:latest + +RUN /pyrocket_scripts/install-conda-packages.sh environment.yml ``` environment.yml @@ -71,6 +80,8 @@ your-repo/ Dockerfile ``` FROM ghcr.io/nmfs-opensci/py-rocket-base:latest + +RUN /pyrocket_scripts/install-r-packages.sh install.R ``` install.R @@ -82,6 +93,34 @@ list.of.packages <- c("ncdf4", "httr", "plyr", "lubridate") install.packages(list.of.packages, repos=repo) ``` +### Add some linux packages + +You want to add some linux packages with apt-get. `apt-get` requires root so you will need to switch to root and switch back to `${NB_USER}`. + +``` +your-repo/ +├── Dockerfile +├── apt.txt +``` + +Dockerfile +``` +FROM ghcr.io/nmfs-opensci/py-rocket-base:latest + +USER root +RUN /pyrocket_scripts/install-apt-packages.sh apt.txt +USER ${NB_USER} +``` + +apt.txt +``` +# a package +libgl1-mesa-glx + +# Another +vim +``` + ### Add R geospatial packages Geospatial packages require some linux packages. To get this working in your Docker image add this to your Docker file: @@ -91,8 +130,9 @@ Dockerfile FROM ghcr.io/nmfs-opensci/py-rocket-base:latest USER root -RUN /rocker_scripts/install_geospatial.sh -USER ${NB_USER} +RUN PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin && \ + /rocker_scripts/install_geospatial.sh +USER ${NB_USER} ``` You have access to all the rocker_scripts and you can run these similar to the line above. diff --git a/book/desktop.qmd b/book/desktop.qmd index 8043c1e..1e9e215 100644 --- a/book/desktop.qmd +++ b/book/desktop.qmd @@ -8,6 +8,14 @@ py-rocket-base puts these `.desktop` files in `/usr/share/Desktop`. Typically th ## Adding an application in your child docker image +Use the pyrocket script, `install-desktop.sh` to set up the desktop and move your files to the proper location. Here is the code for your Docker file. This script must be run as root. It does not take any arguments. Instead you include your desktop files in a directory called `Desktop` at the base level with your Docker file. + +``` +USER root +RUN /pyrocket_scripts/install-desktop.sh +USER ${NB_USER} +``` + ### Create the Desktop directory Create the directory and add the .desktop and optional .png and .xml files. py-rocket-base will move them to the correct places (`/usr/share/applications` and `/usr/share/Desktop`, `/usr/share/mime/packages` and icon locations). diff --git a/docs/configuration_files.html b/docs/configuration_files.html index 953c820..b40d173 100644 --- a/docs/configuration_files.html +++ b/docs/configuration_files.html @@ -175,14 +175,16 @@

Table of contents

@@ -208,9 +210,11 @@

2 

2.1 environment.yml

+

The install-conda-packages.sh script will install conda packages to the conda notebook environment, the user environment in the py-rocket-base image (same as for pangeo and repo2docker images).

+

Here is the code for your Docker file. You can name the conda package file to something other than environment.yml. Make sure your file has name:. The name is arbitrary. It is ignored but required for the script.

+
RUN /pyrocket_scripts/install-conda-packages.sh environment.yml

This is a standard format. You can add version pinning.

environment.yml

name: optional
@@ -220,49 +224,75 @@ 

-
-

2.2 install.R

+
+

2.2 conda-lock.yml

+

Instead of a list of conda packages (typically called environment.yml), you can use a conda lock file instead.

+

Here is the code for your Docker file. You can name your conda lock file something other than conda-lock.yml.

+
RUN /pyrocket_scripts/install-conda-packages.sh conda-lock.yml
+
+
+

2.3 requirments.txt

+

The install-pip-packages.sh script will install packages using pip. Here is the code for your Docker file. You can name your pip package file something other than requirements.txt.

+
RUN /pyrocket_scripts/install-pip-packages.sh requirements.txt
+

requirements.txt

+
#a package
+harmony-py
+
+
+
+

2.4 install.R

+

The install-r-packages.sh script will run the supplied R script which you can use to install R packages to the system library.

+

Here is the code for your Docker file. You can name the R script file to something other than install.R. Make sure your file is an R script.

+
RUN /pyrocket_scripts/install-r-packages.sh install.R

install.R example

# to match rocker/verse:4.4 used in py-rocker-base
 # look up the date that the Rocker image was created and put that
 repo <- "https://p3m.dev/cran/__linux__/jammy/2024-05-13"
 list.of.packages <- c("ncdf4", "httr", "plyr", "lubridate")
 install.packages(list.of.packages, repos=repo)
-
-

2.2.1 Add R geospatial packages

-

Geospatial packages require some linux packages. To get this working in your docker image add this to your Docker file:

+
+

2.4.1 Add R geospatial packages

+

Geospatial packages require some linux packages. To get this working in your Docker image add this to your Docker file:

+

Dockerfile

FROM ghcr.io/nmfs-opensci/py-rocket-base:latest
 
 USER root
-RUN /rocker_scripts/install_geospatial.sh
-USER ${NB_USER} 
+RUN PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin && \ + /rocker_scripts/install_geospatial.sh +USER ${NB_USER}
-
-

2.3 apt.txt

-

Standard format. You can have comments.

+
+

2.5 apt.txt

+

The install-apt-packages.sh script will install packages with apt-get. Here is the code for your Docker file. You can name the apt file of packages names to something other than apt.txt. Comments and newlines are allowed. Installation requires root.

+
USER root
+RUN /pyrocket_scripts/install-apt-packages.sh apt.txt
+USER ${NB_USER}
+

apt.txt example

# Some useful stuff
 tk-dev
 
 # Add some more
 cmocean
-
-

2.4 postBuild

-

This is a script that will be run after all the other commands. This script is run as jovyan not as root. If you need commands run as root, you will need to add these to the Docker file.

+
+

2.6 postBuild

+

The run-postbuild.sh script can be run as root or jovyan (${NB_USER}). This script does not accept a file name. You need to name your postBuild script postBuild and put at the base level with your Docker file.

+
RUN /pyrocket_scripts/run-postbuild.sh

postBuild

#!/bin/bash -l
 set -e
 
 <bash commands>
-
-

2.5 start

-

start bash code is run when the image starts. py-rocker-base has a start script at ${REPO_DIR}/start which loads the Desktop applications. If you change that start file, then the Desktop apps will not be loaded properly.

-

By default, if you include start in the child repo then that script is sourced within the ${REPO_DIR}/start script at the end. If you don’t want that behavior and want the whole start script replaced, then you will need to do that in your Docker file by copying your start file onto ${REPO_DIR}/start.

+
+

2.7 start

+

The start bash code is run when the image starts. py-rocker-base has a start script at ${REPO_DIR}/start which loads the Desktop applications. If you change that start file (by copying your start file onto that location), then the Desktop apps will not be loaded properly. Instead, the setup-start.sh will add your start file to the end of ${REPO_DIR}/start so that the Desktop is still setup properly.

+

The setup-start.sh script does not accept a file name. You need to name your start script start and put at the base level with your Docker file.

+
RUN /pyrocket_scripts/setup-start.sh
-
-

2.6 Desktop applications

+
+

2.8 Desktop applications

See the chapter on Desktop applications.

diff --git a/docs/customizing.html b/docs/customizing.html index df1d227..771b854 100644 --- a/docs/customizing.html +++ b/docs/customizing.html @@ -179,7 +179,8 @@

Table of contents

@@ -206,30 +207,31 @@

1 

1.2 Examples

@@ -240,7 +242,9 @@

Dockerfile

-
FROM ghcr.io/nmfs-opensci/py-rocket-base:latest
+
FROM ghcr.io/nmfs-opensci/py-rocket-base:latest
+
+RUN /pyrocket_scripts/install-r-packages.sh install.R

install.R

# to match rocker/verse:4.4 used in py-rocker-base
 # look up the date that the Rocker image was created and put that
@@ -264,15 +270,35 @@ 

-
-

1.2.3 Add R geospatial packages

+
+

1.2.3 Add some linux packages

+

You want to add some linux packages with apt-get. apt-get requires root so you will need to switch to root and switch back to ${NB_USER}.

+
your-repo/
+├── Dockerfile
+├── apt.txt
+

Dockerfile

+
FROM ghcr.io/nmfs-opensci/py-rocket-base:latest
+
+USER root
+RUN /pyrocket_scripts/install-apt-packages.sh apt.txt
+USER ${NB_USER}
+

apt.txt

+
# a package
+libgl1-mesa-glx
+
+# Another
+vim
+
+
+

1.2.4 Add R geospatial packages

Geospatial packages require some linux packages. To get this working in your Docker image add this to your Docker file:

Dockerfile

FROM ghcr.io/nmfs-opensci/py-rocket-base:latest
 
 USER root
-RUN /rocker_scripts/install_geospatial.sh
-USER ${NB_USER} 
+RUN PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin && \ + /rocker_scripts/install_geospatial.sh +USER ${NB_USER}

You have access to all the rocker_scripts and you can run these similar to the line above.

diff --git a/docs/desktop.html b/docs/desktop.html index b0305c9..0aaba1b 100644 --- a/docs/desktop.html +++ b/docs/desktop.html @@ -209,6 +209,10 @@

4 

4.1 Adding an application in your child docker image

+

Use the pyrocket script, install-desktop.sh to set up the desktop and move your files to the proper location. Here is the code for your Docker file. This script must be run as root. It does not take any arguments. Instead you include your desktop files in a directory called Desktop at the base level with your Docker file.

+
USER root
+RUN /pyrocket_scripts/install-desktop.sh
+USER ${NB_USER}

4.1.1 Create the Desktop directory

Create the directory and add the .desktop and optional .png and .xml files. py-rocket-base will move them to the correct places (/usr/share/applications and /usr/share/Desktop, /usr/share/mime/packages and icon locations).

diff --git a/docs/search.json b/docs/search.json index d9f8774..1189750 100644 --- a/docs/search.json +++ b/docs/search.json @@ -34,7 +34,7 @@ "href": "customizing.html", "title": "1  Using py-rocket-base", "section": "", - "text": "1.1 File structure\nOnly Dockerfile is required. The rest are optional.\nRead configuration_files to learn about apt.txt, environment.yml, install.R, postBuild, and start. Read Desktop to learn about the Desktop folder and files for applications.", + "text": "1.1 File structure\nHere is a typical repo structure. Only the Dockerfile is required. The rest are optional. The files names, apt.txt, environment.yml, requirements.txt and install.R are optional. You can name these files other names and still use them in the pyrocket scripts. Desktop, start and postBuild must be named exactly this to use them in the pyrocket scripts (these scripts do not take filename arguments).\nRead configuration_files to learn about apt.txt, environment.yml, install.R, requirements.txt, postBuild, and start. Read Desktop to learn about the Desktop folder and files for applications.", "crumbs": [ "1  Using py-rocket-base" ] @@ -44,7 +44,7 @@ "href": "customizing.html#file-structure", "title": "1  Using py-rocket-base", "section": "", - "text": "your-repo/\n├── Dockerfile\n├── apt.txt\n├── environment.yml\n├── install.R\n├── postBuild\n├── start\n├── Desktop/\n│ ├── qgis.desktop\n│ ├── qgis.xml\n│ └── qgis.png", + "text": "your-repo/\n├── Dockerfile\n├── apt.txt\n├── environment.yml\n├── install.R\n├── requirements.txt\n├── postBuild\n├── start\n├── Desktop/\n│ ├── qgis.desktop\n│ ├── qgis.xml\n│ └── qgis.png", "crumbs": [ "1  Using py-rocket-base" ] @@ -54,7 +54,7 @@ "href": "customizing.html#examples", "title": "1  Using py-rocket-base", "section": "1.2 Examples", - "text": "1.2 Examples\n\n1.2.1 Add some Python packages\nYou want to add some Python packages to the conda notebook environment.\nyour-repo/\n├── Dockerfile\n├── environment.yml\nDockerfile\nFROM ghcr.io/nmfs-opensci/py-rocket-base:latest\nenvironment.yml\nname: optional\nchannels:\n - conda-forge\ndependencies:\n - cmocean\n - numpy\n\n\n1.2.2 Add R packages\nAdd an R script to install packages. Important: packages that have linux dependencies (e.g. all the spatial packages depend on GDAL) will not work if you use install.packages(). GDAL will not be installed.\nyour-repo/\n├── Dockerfile\n├── install.R\nDockerfile\nFROM ghcr.io/nmfs-opensci/py-rocket-base:latest\ninstall.R\n# to match rocker/verse:4.4 used in py-rocker-base\n# look up the date that the Rocker image was created and put that\nrepo <- \"https://p3m.dev/cran/__linux__/jammy/2024-05-13\"\nlist.of.packages <- c(\"ncdf4\", \"httr\", \"plyr\", \"lubridate\")\ninstall.packages(list.of.packages, repos=repo)\n\n\n1.2.3 Add R geospatial packages\nGeospatial packages require some linux packages. To get this working in your Docker image add this to your Docker file:\nDockerfile\nFROM ghcr.io/nmfs-opensci/py-rocket-base:latest\n\nUSER root\nRUN /rocker_scripts/install_geospatial.sh\nUSER ${NB_USER} \nYou have access to all the rocker_scripts and you can run these similar to the line above.", + "text": "1.2 Examples\n\n1.2.1 Add some Python packages\nYou want to add some Python packages to the conda notebook environment.\nyour-repo/\n├── Dockerfile\n├── environment.yml\nDockerfile\nFROM ghcr.io/nmfs-opensci/py-rocket-base:latest\n\nRUN /pyrocket_scripts/install-conda-packages.sh environment.yml\nenvironment.yml\nname: optional\nchannels:\n - conda-forge\ndependencies:\n - cmocean\n - numpy\n\n\n1.2.2 Add R packages\nAdd an R script to install packages. Important: packages that have linux dependencies (e.g. all the spatial packages depend on GDAL) will not work if you use install.packages(). GDAL will not be installed.\nyour-repo/\n├── Dockerfile\n├── install.R\nDockerfile\nFROM ghcr.io/nmfs-opensci/py-rocket-base:latest\n\nRUN /pyrocket_scripts/install-r-packages.sh install.R\ninstall.R\n# to match rocker/verse:4.4 used in py-rocker-base\n# look up the date that the Rocker image was created and put that\nrepo <- \"https://p3m.dev/cran/__linux__/jammy/2024-05-13\"\nlist.of.packages <- c(\"ncdf4\", \"httr\", \"plyr\", \"lubridate\")\ninstall.packages(list.of.packages, repos=repo)\n\n\n1.2.3 Add some linux packages\nYou want to add some linux packages with apt-get. apt-get requires root so you will need to switch to root and switch back to ${NB_USER}.\nyour-repo/\n├── Dockerfile\n├── apt.txt\nDockerfile\nFROM ghcr.io/nmfs-opensci/py-rocket-base:latest\n\nUSER root\nRUN /pyrocket_scripts/install-apt-packages.sh apt.txt\nUSER ${NB_USER}\napt.txt\n# a package\nlibgl1-mesa-glx\n\n# Another\nvim\n\n\n1.2.4 Add R geospatial packages\nGeospatial packages require some linux packages. To get this working in your Docker image add this to your Docker file:\nDockerfile\nFROM ghcr.io/nmfs-opensci/py-rocket-base:latest\n\nUSER root\nRUN PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin && \\\n /rocker_scripts/install_geospatial.sh\nUSER ${NB_USER}\nYou have access to all the rocker_scripts and you can run these similar to the line above.", "crumbs": [ "1  Using py-rocket-base" ] @@ -64,7 +64,7 @@ "href": "configuration_files.html", "title": "2  Configuration files", "section": "", - "text": "2.1 environment.yml\nThis is a standard format. You can add version pinning.\nenvironment.yml", + "text": "2.1 environment.yml\nThe install-conda-packages.sh script will install conda packages to the conda notebook environment, the user environment in the py-rocket-base image (same as for pangeo and repo2docker images).\nHere is the code for your Docker file. You can name the conda package file to something other than environment.yml. Make sure your file has name:. The name is arbitrary. It is ignored but required for the script.\nThis is a standard format. You can add version pinning.\nenvironment.yml", "crumbs": [ "2  Configuration files" ] @@ -74,7 +74,27 @@ "href": "configuration_files.html#environment.yml", "title": "2  Configuration files", "section": "", - "text": "name: optional\nchannels:\n - conda-forge\ndependencies:\n - cmocean\n - numpy", + "text": "RUN /pyrocket_scripts/install-conda-packages.sh environment.yml\n\n\nname: optional\nchannels:\n - conda-forge\ndependencies:\n - cmocean\n - numpy", + "crumbs": [ + "2  Configuration files" + ] + }, + { + "objectID": "configuration_files.html#conda-lock.yml", + "href": "configuration_files.html#conda-lock.yml", + "title": "2  Configuration files", + "section": "2.2 conda-lock.yml", + "text": "2.2 conda-lock.yml\nInstead of a list of conda packages (typically called environment.yml), you can use a conda lock file instead.\nHere is the code for your Docker file. You can name your conda lock file something other than conda-lock.yml.\nRUN /pyrocket_scripts/install-conda-packages.sh conda-lock.yml", + "crumbs": [ + "2  Configuration files" + ] + }, + { + "objectID": "configuration_files.html#requirments.txt", + "href": "configuration_files.html#requirments.txt", + "title": "2  Configuration files", + "section": "2.3 requirments.txt", + "text": "2.3 requirments.txt\nThe install-pip-packages.sh script will install packages using pip. Here is the code for your Docker file. You can name your pip package file something other than requirements.txt.\nRUN /pyrocket_scripts/install-pip-packages.sh requirements.txt\nrequirements.txt\n#a package\nharmony-py", "crumbs": [ "2  Configuration files" ] @@ -83,8 +103,8 @@ "objectID": "configuration_files.html#install.r", "href": "configuration_files.html#install.r", "title": "2  Configuration files", - "section": "2.2 install.R", - "text": "2.2 install.R\ninstall.R example\n# to match rocker/verse:4.4 used in py-rocker-base\n# look up the date that the Rocker image was created and put that\nrepo <- \"https://p3m.dev/cran/__linux__/jammy/2024-05-13\"\nlist.of.packages <- c(\"ncdf4\", \"httr\", \"plyr\", \"lubridate\")\ninstall.packages(list.of.packages, repos=repo)\n\n2.2.1 Add R geospatial packages\nGeospatial packages require some linux packages. To get this working in your docker image add this to your Docker file:\nFROM ghcr.io/nmfs-opensci/py-rocket-base:latest\n\nUSER root\nRUN /rocker_scripts/install_geospatial.sh\nUSER ${NB_USER}", + "section": "2.4 install.R", + "text": "2.4 install.R\nThe install-r-packages.sh script will run the supplied R script which you can use to install R packages to the system library.\nHere is the code for your Docker file. You can name the R script file to something other than install.R. Make sure your file is an R script.\nRUN /pyrocket_scripts/install-r-packages.sh install.R\ninstall.R example\n# to match rocker/verse:4.4 used in py-rocker-base\n# look up the date that the Rocker image was created and put that\nrepo <- \"https://p3m.dev/cran/__linux__/jammy/2024-05-13\"\nlist.of.packages <- c(\"ncdf4\", \"httr\", \"plyr\", \"lubridate\")\ninstall.packages(list.of.packages, repos=repo)\n\n2.4.1 Add R geospatial packages\nGeospatial packages require some linux packages. To get this working in your Docker image add this to your Docker file:\nDockerfile\nFROM ghcr.io/nmfs-opensci/py-rocket-base:latest\n\nUSER root\nRUN PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin && \\\n /rocker_scripts/install_geospatial.sh\nUSER ${NB_USER}", "crumbs": [ "2  Configuration files" ] @@ -93,8 +113,8 @@ "objectID": "configuration_files.html#apt.txt", "href": "configuration_files.html#apt.txt", "title": "2  Configuration files", - "section": "2.3 apt.txt", - "text": "2.3 apt.txt\nStandard format. You can have comments.\n# Some useful stuff\ntk-dev\n\n# Add some more\ncmocean", + "section": "2.5 apt.txt", + "text": "2.5 apt.txt\nThe install-apt-packages.sh script will install packages with apt-get. Here is the code for your Docker file. You can name the apt file of packages names to something other than apt.txt. Comments and newlines are allowed. Installation requires root.\nUSER root\nRUN /pyrocket_scripts/install-apt-packages.sh apt.txt\nUSER ${NB_USER}\napt.txt example\n# Some useful stuff\ntk-dev\n\n# Add some more\ncmocean", "crumbs": [ "2  Configuration files" ] @@ -103,8 +123,8 @@ "objectID": "configuration_files.html#postbuild", "href": "configuration_files.html#postbuild", "title": "2  Configuration files", - "section": "2.4 postBuild", - "text": "2.4 postBuild\nThis is a script that will be run after all the other commands. This script is run as jovyan not as root. If you need commands run as root, you will need to add these to the Docker file.\npostBuild\n#!/bin/bash -l\nset -e\n\n<bash commands>", + "section": "2.6 postBuild", + "text": "2.6 postBuild\nThe run-postbuild.sh script can be run as root or jovyan (${NB_USER}). This script does not accept a file name. You need to name your postBuild script postBuild and put at the base level with your Docker file.\nRUN /pyrocket_scripts/run-postbuild.sh\npostBuild\n#!/bin/bash -l\nset -e\n\n<bash commands>", "crumbs": [ "2  Configuration files" ] @@ -113,8 +133,8 @@ "objectID": "configuration_files.html#start", "href": "configuration_files.html#start", "title": "2  Configuration files", - "section": "2.5 start", - "text": "2.5 start\nstart bash code is run when the image starts. py-rocker-base has a start script at ${REPO_DIR}/start which loads the Desktop applications. If you change that start file, then the Desktop apps will not be loaded properly.\nBy default, if you include start in the child repo then that script is sourced within the ${REPO_DIR}/start script at the end. If you don’t want that behavior and want the whole start script replaced, then you will need to do that in your Docker file by copying your start file onto ${REPO_DIR}/start.", + "section": "2.7 start", + "text": "2.7 start\nThe start bash code is run when the image starts. py-rocker-base has a start script at ${REPO_DIR}/start which loads the Desktop applications. If you change that start file (by copying your start file onto that location), then the Desktop apps will not be loaded properly. Instead, the setup-start.sh will add your start file to the end of ${REPO_DIR}/start so that the Desktop is still setup properly.\nThe setup-start.sh script does not accept a file name. You need to name your start script start and put at the base level with your Docker file.\nRUN /pyrocket_scripts/setup-start.sh", "crumbs": [ "2  Configuration files" ] @@ -123,8 +143,8 @@ "objectID": "configuration_files.html#desktop-applications", "href": "configuration_files.html#desktop-applications", "title": "2  Configuration files", - "section": "2.6 Desktop applications", - "text": "2.6 Desktop applications\nSee the chapter on Desktop applications.", + "section": "2.8 Desktop applications", + "text": "2.8 Desktop applications\nSee the chapter on Desktop applications.", "crumbs": [ "2  Configuration files" ] @@ -144,7 +164,7 @@ "href": "desktop.html", "title": "4  Desktop", "section": "", - "text": "4.1 Adding an application in your child docker image", + "text": "4.1 Adding an application in your child docker image\nUse the pyrocket script, install-desktop.sh to set up the desktop and move your files to the proper location. Here is the code for your Docker file. This script must be run as root. It does not take any arguments. Instead you include your desktop files in a directory called Desktop at the base level with your Docker file.", "crumbs": [ "4  Desktop" ] @@ -154,7 +174,7 @@ "href": "desktop.html#adding-an-application-in-your-child-docker-image", "title": "4  Desktop", "section": "", - "text": "4.1.1 Create the Desktop directory\nCreate the directory and add the .desktop and optional .png and .xml files. py-rocket-base will move them to the correct places (/usr/share/applications and /usr/share/Desktop, /usr/share/mime/packages and icon locations).\nyour-repo/\n├── Dockerfile\n├── optional extra files\n├── Desktop/\n│ ├── qgis.desktop\n│ ├── qgis.xml\n│ └── qgis.png\n\n4.1.1.1 .desktop file\nThe .desktop file is a configuration file that describes how an application is launched. The required parts are Name, Exec and Type. MimeType specifies what types of files the application can use (optional).\ncdat.desktop\n[Desktop Entry]\nType=Application\nName=CWUtils\nGenericName=CoastWatch Data Analysis Tool\nIcon=/srv/repo/Desktop/cdat.png\nTryExec=cdat\nExec=cdat %F\nTerminal=false\nStartupNotify=false\nCategories=Qt;Education;Science;Geography;\nKeywords=map;globe;\n\n\n4.1.1.2 .xml\nYou can specify the mime types via xml.\n\n\n4.1.1.3 icons\nYou can include a png or svg for the icon. py-rocket-base will place this in /usr/share/icons/hicolor. If you put your icon file in the Desktop directory in your repo, then in your desktop file, use the file name without the extension. If for some reason, your icon is not showing up, use the direct url /srv/repo/Desktop/your-icon-name.png. If the icon cache does not update properly, you have the use the full url.\nIcon=cdat\nYou can also use an absolute file path.\nIf an icon is installed with your application, it will be in the installation files.\nIcon=/srv/conda/envs/notebook/share/qgis/images/icons/qgis-icon-512x512.png\nor if you include an icon in your Desktop directory, it will be in /srv/repo/Desktop.\nIcon=/srv/repo/Desktop/cdat.png\n\n\n\n4.1.2 Install the application\nHow you install the application really varies. Here are 2 examples.\nQGIS\n\nadd qgis to environment.yml\nadd libgl1-mesa-glx to apt.txt\nadd the .desktop file to Desktop directory\n\nqgis.desktop\n# From: https://github.com/qgis/QGIS/blob/ltr-3_28/linux/org.qgis.qgis.desktop.in\n[Desktop Entry]\nType=Application\nName=QGIS Desktop\nGenericName=Geographic Information System\nIcon=/srv/conda/envs/notebook/share/qgis/images/icons/qgis-icon-512x512.png\nTryExec=qgis\nExec=qgis %F\nTerminal=false\nStartupNotify=false\nCategories=Qt;Education;Science;Geography;\nMimeType=application/x-qgis-project;application/x-qgis-project-container;application/x-qgis-layer-settings;application/x-qgis-layer-definition;application/x-qgis-composer-template;image/tiff;image/jpeg;image/jp2;application/x-raster-aig;application/x-raster-ecw;application/x-raster-mrsid;application/x-mapinfo-mif;application/x-esri-shape;application/vnd.google-earth.kml+xml;application/vnd.google-earth.kmz;application/geopackage+sqlite3;\nKeywords=map;globe;postgis;wms;wfs;ogc;osgeo;\nStartupWMClass=QGIS3\nCoastWatch Utilities\nAdd this to the docker file to install\nUSER root\n# Install cwutils\nRUN cd /tmp && \\\n wget https://www.star.nesdis.noaa.gov/socd/coastwatch/cwf/cwutils-4_0_0_198-linux-x86_64.tar.gz && \\\n tar -zxf cwutils-4_0_0_198-linux-x86_64.tar.gz && \\\n rm -rf cwutils-4_0_0_198-linux-x86_64.tar.gz\nENV PATH=${PATH}:/tmp/cwutils_4.0.0.198/bin\nENV MANPATH=${MANPATH}:/tmp/cwutils_4.0.0.198/doc/man\nENV INSTALL4J ADD VM PARAMS=-Dsun.java2d.uiScale=2.0\nUSER ${NB_USER}\nAdd this cdat.desktop file to Desktop directory\n[Desktop Entry]\nType=Application\nName=CWUtils\nGenericName=CoastWatch Data Analysis Tool\nIcon=/srv/repo/Desktop/cdat.png\nTryExec=cdat\nExec=cdat %F\nTerminal=false\nStartupNotify=false\nCategories=Qt;Education;Science;Geography;\nKeywords=map;globe;\nAdd cdat.png icon to Desktop directory.", + "text": "USER root\nRUN /pyrocket_scripts/install-desktop.sh\nUSER ${NB_USER}\n\n4.1.1 Create the Desktop directory\nCreate the directory and add the .desktop and optional .png and .xml files. py-rocket-base will move them to the correct places (/usr/share/applications and /usr/share/Desktop, /usr/share/mime/packages and icon locations).\nyour-repo/\n├── Dockerfile\n├── optional extra files\n├── Desktop/\n│ ├── qgis.desktop\n│ ├── qgis.xml\n│ └── qgis.png\n\n4.1.1.1 .desktop file\nThe .desktop file is a configuration file that describes how an application is launched. The required parts are Name, Exec and Type. MimeType specifies what types of files the application can use (optional).\ncdat.desktop\n[Desktop Entry]\nType=Application\nName=CWUtils\nGenericName=CoastWatch Data Analysis Tool\nIcon=/srv/repo/Desktop/cdat.png\nTryExec=cdat\nExec=cdat %F\nTerminal=false\nStartupNotify=false\nCategories=Qt;Education;Science;Geography;\nKeywords=map;globe;\n\n\n4.1.1.2 .xml\nYou can specify the mime types via xml.\n\n\n4.1.1.3 icons\nYou can include a png or svg for the icon. py-rocket-base will place this in /usr/share/icons/hicolor. If you put your icon file in the Desktop directory in your repo, then in your desktop file, use the file name without the extension. If for some reason, your icon is not showing up, use the direct url /srv/repo/Desktop/your-icon-name.png. If the icon cache does not update properly, you have the use the full url.\nIcon=cdat\nYou can also use an absolute file path.\nIf an icon is installed with your application, it will be in the installation files.\nIcon=/srv/conda/envs/notebook/share/qgis/images/icons/qgis-icon-512x512.png\nor if you include an icon in your Desktop directory, it will be in /srv/repo/Desktop.\nIcon=/srv/repo/Desktop/cdat.png\n\n\n\n4.1.2 Install the application\nHow you install the application really varies. Here are 2 examples.\nQGIS\n\nadd qgis to environment.yml\nadd libgl1-mesa-glx to apt.txt\nadd the .desktop file to Desktop directory\n\nqgis.desktop\n# From: https://github.com/qgis/QGIS/blob/ltr-3_28/linux/org.qgis.qgis.desktop.in\n[Desktop Entry]\nType=Application\nName=QGIS Desktop\nGenericName=Geographic Information System\nIcon=/srv/conda/envs/notebook/share/qgis/images/icons/qgis-icon-512x512.png\nTryExec=qgis\nExec=qgis %F\nTerminal=false\nStartupNotify=false\nCategories=Qt;Education;Science;Geography;\nMimeType=application/x-qgis-project;application/x-qgis-project-container;application/x-qgis-layer-settings;application/x-qgis-layer-definition;application/x-qgis-composer-template;image/tiff;image/jpeg;image/jp2;application/x-raster-aig;application/x-raster-ecw;application/x-raster-mrsid;application/x-mapinfo-mif;application/x-esri-shape;application/vnd.google-earth.kml+xml;application/vnd.google-earth.kmz;application/geopackage+sqlite3;\nKeywords=map;globe;postgis;wms;wfs;ogc;osgeo;\nStartupWMClass=QGIS3\nCoastWatch Utilities\nAdd this to the docker file to install\nUSER root\n# Install cwutils\nRUN cd /tmp && \\\n wget https://www.star.nesdis.noaa.gov/socd/coastwatch/cwf/cwutils-4_0_0_198-linux-x86_64.tar.gz && \\\n tar -zxf cwutils-4_0_0_198-linux-x86_64.tar.gz && \\\n rm -rf cwutils-4_0_0_198-linux-x86_64.tar.gz\nENV PATH=${PATH}:/tmp/cwutils_4.0.0.198/bin\nENV MANPATH=${MANPATH}:/tmp/cwutils_4.0.0.198/doc/man\nENV INSTALL4J ADD VM PARAMS=-Dsun.java2d.uiScale=2.0\nUSER ${NB_USER}\nAdd this cdat.desktop file to Desktop directory\n[Desktop Entry]\nType=Application\nName=CWUtils\nGenericName=CoastWatch Data Analysis Tool\nIcon=/srv/repo/Desktop/cdat.png\nTryExec=cdat\nExec=cdat %F\nTerminal=false\nStartupNotify=false\nCategories=Qt;Education;Science;Geography;\nKeywords=map;globe;\nAdd cdat.png icon to Desktop directory.", "crumbs": [ "4  Desktop" ] diff --git a/docs/sitemap.xml b/docs/sitemap.xml index 44d83e3..c75ff6f 100644 --- a/docs/sitemap.xml +++ b/docs/sitemap.xml @@ -2,23 +2,23 @@ https://nmfs-opensci.github.io/py-rocket-base/index.html - 2024-10-30T04:38:49.122Z + 2024-11-05T16:40:51.958Z https://nmfs-opensci.github.io/py-rocket-base/customizing.html - 2024-10-30T04:11:39.623Z + 2024-11-05T16:56:10.142Z https://nmfs-opensci.github.io/py-rocket-base/configuration_files.html - 2024-10-30T04:13:00.834Z + 2024-11-05T17:52:00.525Z https://nmfs-opensci.github.io/py-rocket-base/r-packages.html - 2024-10-30T04:13:29.895Z + 2024-11-05T16:40:51.958Z https://nmfs-opensci.github.io/py-rocket-base/desktop.html - 2024-11-01T04:42:22.268Z + 2024-11-05T17:55:37.558Z https://nmfs-opensci.github.io/py-rocket-base/tex.html @@ -30,6 +30,6 @@ https://nmfs-opensci.github.io/py-rocket-base/developers.html - 2024-10-30T22:08:13.913Z + 2024-11-05T16:40:51.958Z