Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

20241129 zrq gardening #18

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
44 changes: 29 additions & 15 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,25 @@

#
# Docker container to run the IvoaTex build environment.
FROM docker.io/library/ubuntu:21.10
MAINTAINER Dave Morris <[email protected]>
FROM docker.io/library/debian:12.9

ARG builddate
ARG buildtime

LABEL maintainer="Dave Morris <[email protected]>"
LABEL builddate="${builddate}"
LABEL buildtime="${buildtime}"
LABEL gitrepo="https://github.com/ivoa/ivoatex-docker"
MAINTAINER Dave Morris <[email protected]>

LABEL maintainer "Dave Morris <[email protected]>"
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.
Expand All @@ -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.
Expand Down
180 changes: 180 additions & 0 deletions notes/zrq/20241128-01-gardening.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
#
# <meta:header>
# <meta:licence>
# 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 <http://www.gnu.org/licenses/>.
# </meta:licence>
# </meta:header>
#
#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:?}"



Loading