diff --git a/README.md b/README.md index 9fc5104..54b9df7 100644 --- a/README.md +++ b/README.md @@ -12,25 +12,27 @@ Using Podman to build a document in the current directory: --rm \ --tty \ --interactive \ - --volume "${DOC_PATH:?}:/document:rw,Z" \ - ivoa/ivoatex:latest + --volume "${DOC_PATH:?}:/document:rw,z" \ + ghcr.io/ivoa/ivoatex-docker:latest Once inside the container, run the following commands to build the document: make clean make biblio - make forcetex + make To do the same with Docker you need to specify the user `uid` and `gid` so that the resulting documents are owned by your account rather than by root. + DOC_PATH=$(pwd) + docker run \ --rm \ --tty \ --interactive \ --user "$(id -u):$(id -g)" \ --volume "${DOC_PATH:?}:/document:rw,Z" \ - ivoa/ivoatex:latest + ghcr.io/ivoa/ivoatex-docker:latest This project has received funding from the following sources : * The European Commission Framework Programme Horizon 2020 Research and Innovation action under grant agreement n°653477, [ASTERICS](https://cordis.europa.eu/project/id/653477) diff --git a/docker/Dockerfile b/docker/Dockerfile index 5c6377c..a033ef3 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -21,16 +21,25 @@ # # Docker container to run the IvoaTex build environment. -FROM docker.io/library/ubuntu:21.10 -MAINTAINER Dave Morris +FROM docker.io/library/debian:12.9 ARG builddate ARG buildtime -LABEL maintainer="Dave Morris " -LABEL builddate="${builddate}" -LABEL buildtime="${buildtime}" -LABEL gitrepo="https://github.com/ivoa/ivoatex-docker" +MAINTAINER Dave Morris + +LABEL maintainer "Dave Morris " +LABEL buildtag "${buildtag}" +LABEL buildtime "${buildtime}" +LABEL vendor "UK SKA Regional Centre (UKSRC)" +LABEL version "${buildtag}" +LABEL license "GPL-3.0-or-later" +LABEL org.opencontainers.image.created "${buildtime}" +LABEL org.opencontainers.image.vendor "UK SKA Regional Centre (UKSRC)" +LABEL org.opencontainers.image.version "${buildtag}" +LABEL org.opencontainers.image.licenses "GPL-3.0-or-later" +LABEL org.opencontainers.image.source "https://github.com/ivoa/ivoatex-docker" +LABEL org.opencontainers.image.authors "https://github.com/Zarquan" # # Disable interactive install. @@ -39,15 +48,20 @@ ENV DEBIAN_FRONTEND noninteractive # # Install LaTex tools. RUN apt-get update && apt-get -yq install \ - texlive-latex-extra \ - texlive-bibtex-extra \ - build-essential \ - librsvg2-bin \ - imagemagick \ - ghostscript \ - xsltproc \ - cm-super \ - zip + build-essential \ + cm-super \ + ghostscript \ + latexmk \ + librsvg2-bin \ + librsvg2-bin \ + nano \ + pdftk \ + python-is-python3 \ + texlive-latex-extra \ + texlive-bibtex-extra \ + vim \ + xsltproc \ + zip # # Label working directory as a data volume. diff --git a/notes/zrq/20241128-01-gardening.txt b/notes/zrq/20241128-01-gardening.txt new file mode 100644 index 0000000..772b371 --- /dev/null +++ b/notes/zrq/20241128-01-gardening.txt @@ -0,0 +1,180 @@ +# +# +# +# Copyright (c) 2024, Manchester (http://www.manchester.ac.uk/) +# +# This information is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This information is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# +# +#zrq-notes-indent +# +# AIMetrics: [] +# + + + Target: + + Create a new version of the document builder. + + Result: + + Work in progress ... + + +# ----------------------------------------------------- +# Set the build date and repository name. +#[user@desktop] + + repohost="ghcr.io" + repobase="ivoa" + reponame="ivoatex-docker" + repopath="${repohost}/${repobase}" + + buildtag=$(date '+%Y.%m.%d') + builddate=$(date '+%Y.%m.%d') + buildtime=$(date '+%Y-%m-%dT%H:%M:%S') + buildname="ivoatex-docker" + +cat << EOF + +repohost [${repohost}] +repobase [${repobase}] +reponame [${reponame}] +repopath [${repopath}] + +buildname [${buildname}] + +builddate [${builddate}] +buildtime [${buildtime}] + +EOF + + > .... + > .... + + +# ----------------------------------------------------- +# Clear our image cache. +#[user@desktop] + + podman rmi -f $(podman images -aq) + + > .... + > .... + + +# ----------------------------------------------------- +# Build our container. +#[user@desktop] + + podman build \ + --build-arg "builddate=${builddate:?}" \ + --build-arg "buildtime=${buildtime:?}" \ + --tag "${buildname}:latest" \ + --tag "${buildname}:${builddate:?}" \ + docker + + > .... + > .... + > STEP 19/20: VOLUME /document + > --> e558a62e6ca6 + > STEP 20/20: WORKDIR /document + > COMMIT ivoatex-docker:latest + > --> 28deca4eb7bc + > Successfully tagged localhost/ivoatex-docker:2024.11.28 + > Successfully tagged localhost/ivoatex-docker:latest + > 28deca4eb7bc40e73a8c0db136cd784a647fe72cc28528a0b857a092dbdacbac + + + podman images + + > REPOSITORY TAG IMAGE ID CREATED SIZE + > localhost/ivoatex-docker 2024.11.28 28deca4eb7bc 30 seconds ago 2.18 GB + > localhost/ivoatex-docker latest 28deca4eb7bc 30 seconds ago 2.18 GB + > docker.io/library/debian 12.8 63ba939a68fd 2 weeks ago 121 MB + + +# ----------------------------------------------------- +# Check our secret function works. +#[user@desktop] + + getsecret example.frog + + > .... + > .... + + +# ----------------------------------------------------- +# Login to the Docker registry. +#[user@desktop] + + guser=$(getsecret 'devops.ghcrio.user') + gpass=$(getsecret 'devops.ghcrio.pass') + + echo "${gpass:?}" \ + | podman login \ + --password-stdin \ + --username "${guser:?}" \ + "${repopath}" + + > Login Succeeded! + + + +# ----------------------------------------------------- +# Push our image to our GitHub repository. +#[user@desktop] + + podman push \ + "localhost/${buildname}:${builddate:?}" \ + "${repopath:?}/${buildname}:${builddate:?}" + + > .... + > .... + + + podman push \ + "localhost/${buildname}:${builddate:?}" \ + "${repopath:?}/${buildname}:latest" + + > .... + > .... + + +# ----------------------------------------------------- +# ----------------------------------------------------- +# Clear our image cache. +#[user@desktop] + + podman rmi -f $(podman images -aq) + + +# ----------------------------------------------------- +# Test our image. +#[user@desktop] + + podman rmi -f $(podman mages -aq) + + source "${HOME:?}/execbroker.env" + podman run \ + --rm \ + --tty \ + --interactive \ + --name ivoatex \ + --volume "${EXECBROKER_CODE}:/document:rw,z" \ + "${repopath:?}/${buildname}:${builddate:?}" + + + diff --git a/notes/zrq/20250118-01-gardening.txt b/notes/zrq/20250118-01-gardening.txt new file mode 100644 index 0000000..4c1d70e --- /dev/null +++ b/notes/zrq/20250118-01-gardening.txt @@ -0,0 +1,242 @@ +# +# +# +# Copyright (c) 2024, Manchester (http://www.manchester.ac.uk/) +# +# This information is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This information is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# +# +#zrq-notes-indent +# +# AIMetrics: [] +# + + Target: + + Update to newer versions + + Result: + + Work in progress ... + + +# ----------------------------------------------------- +# Set the build date and repository name. +#[user@desktop] + + repohost="ghcr.io" + repobase="ivoa" + reponame="ivoatex-docker" + repopath="${repohost}/${repobase}" + + buildtag=$(date '+%Y.%m.%d') + builddate=$(date '+%Y.%m.%d') + buildtime=$(date '+%Y-%m-%dT%H:%M:%S') + buildname="ivoatex-docker" + +cat << EOF + +repohost [${repohost}] +repobase [${repobase}] +reponame [${reponame}] +repopath [${repopath}] + +buildname [${buildname}] + +builddate [${builddate}] +buildtime [${buildtime}] + +EOF + + > repohost [ghcr.io] + > repobase [ivoa] + > reponame [ivoatex-docker] + > repopath [ghcr.io/ivoa] + > + > buildname [ivoatex-docker] + > + > builddate [2025.01.18] + > buildtime [2025-01-18T05:32:09] + + +# ----------------------------------------------------- +# Clear our image cache. +#[user@desktop] + + podman rmi -f $(podman images -aq) + + > .... + > .... + + +# ----------------------------------------------------- +# Build our container. +#[user@desktop] + + podman build \ + --build-arg "builddate=${builddate:?}" \ + --build-arg "buildtime=${buildtime:?}" \ + --tag "${buildname}:latest" \ + --tag "${buildname}:${builddate:?}" \ + docker + + > .... + > .... + > STEP 19/20: VOLUME /document + > --> 6473496b52b5 + > STEP 20/20: WORKDIR /document + > COMMIT ivoatex-docker:latest + > --> 6cc1ac7381b9 + > Successfully tagged localhost/ivoatex-docker:2025.01.18 + > Successfully tagged localhost/ivoatex-docker:latest + > 6cc1ac7381b962e90df75a790cd8f0a735bf09fee56c2f3bccecaf6219243491 + + + podman images + + > REPOSITORY TAG IMAGE ID CREATED SIZE + > localhost/ivoatex-docker 2025.01.18 6cc1ac7381b9 28 minutes ago 2.22 GB + > localhost/ivoatex-docker latest 6cc1ac7381b9 28 minutes ago 2.22 GB + > docker.io/library/debian 12.9 30f245ccb05f 5 days ago 121 MB + + +# ----------------------------------------------------- +# Check we have all the Python modules we need. +# Test file created by grepping the ivoatex source for 'import'. +# grep -r -e '^import' -e '^from' *.py | sed 's/.*:\(.*\)$/\1/' | sort | uniq +# +#[user@desktop] + + podman run \ + --rm \ + --tty \ + --interactive \ + ivoatex-docker:latest + + pushd /tmp + + mkdir test + pushd test + +cat > text.py << EOF +#!/usr/bin/env python + +from io import StringIO +from urllib import parse, request +from xml.etree import ElementTree as etree +import csv +import datetime +import json +import os +import pprint +import re +import request +import subprocess +import sys +import tempfile +import webbrowser + +print("Done") + +EOF + + chmod a+x text.py + ./text.py + + + + +# ----------------------------------------------------- +# Check our secret function works. +#[user@desktop] + + getsecret example.frog + + > .... + > .... + + +# ----------------------------------------------------- +# Login to the Docker registry. +#[user@desktop] + + guser=$(getsecret 'devops.ghcrio.user') + gpass=$(getsecret 'devops.ghcrio.pass') + + echo "${gpass:?}" \ + | podman login \ + --password-stdin \ + --username "${guser:?}" \ + "${repopath}" + + > Login Succeeded! + + +# ----------------------------------------------------- +# Push our image to our GitHub repository. +#[user@desktop] + + podman push \ + "localhost/${buildname}:${builddate:?}" \ + "${repopath:?}/${buildname}:${builddate:?}" + + > .... + > .... + + + podman push \ + "localhost/${buildname}:${builddate:?}" \ + "${repopath:?}/${buildname}:latest" + + > .... + > .... + + +# ----------------------------------------------------- +# ----------------------------------------------------- +# Clear our image cache. +#[user@desktop] + + podman rmi -f $(podman images -aq) + + > .... + > .... + +# ----------------------------------------------------- +# Test our image. +#[user@desktop] + + source "${HOME:?}/execbroker.env" + podman run \ + --rm \ + --tty \ + --interactive \ + --name ivoatex \ + --volume "${EXECBROKER_CODE}:/document:rw,z" \ + "${repopath:?}/${buildname}:${builddate:?}" + + make clean + make + + > .... + > .... + > Latexmk: Found bibliography file(s): + > ./ivoatex/docrepo.bib + > ./ivoatex/ivoabib.bib + > Latexmk: All targets () are up-to-date + + + +