Skip to contentSkip to conversation

Add Dockerfile and Q&A

PATCH Superseded Akira Yokosawa 2 participants 10 messages Jan 6, 2021 – Jan 7, 2021

lore
Share & tools
lore
#0 lore raw

cover Add Dockerfile and Q&A

Subject: [PATCH 0/2 -perfbook] Add Dockerfile and Q&A

Regarding the strange -nq build result Paul recently encountered, I prepared a Ubuntu Focal based minimal Docker image to build perfbook.

This patch set adds a Dockerfile I used and a Q&A entry in FAQ-BUILD.txt.
docker/ subdirectory also holds steel city comic font to be copied into the image.

--
Akira Yokosawa (2):
Add files to build Docker image for perfbook build
FAQ-BUILD: Add Q&A on Docker image

 FAQ-BUILD.txt                       |  22 ++++++++++++++++++++++
 docker/Dockerfile                   |  16 ++++++++++++++++
 docker/steel-city-comic.regular.ttf | Bin 0 -> 23280 bytes
 3 files changed, 38 insertions(+)
 create mode 100644 docker/Dockerfile
 create mode 100644 docker/steel-city-comic.regular.ttf
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/2 Add files to build Docker image for perfbook build

From 059210ea5ec51981d798ced571f73855baf63bcb Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Wed, 6 Jan 2021 18:24:48 +0900
Subject: [PATCH 1/2 -perfbook] Add files to build Docker image for perfbook build

Contains minimal packages to build perfbook*.pdf

---
 docker/Dockerfile                   |  16 ++++++++++++++++
 docker/steel-city-comic.regular.ttf | Bin 0 -> 23280 bytes
 2 files changed, 16 insertions(+)
 create mode 100644 docker/Dockerfile
 create mode 100644 docker/steel-city-comic.regular.ttf
docker/Dockerfile new file +16 -0
new file mode 100644
index 00000000..cf3c0486
@@ -0,0 +1,16 @@
+FROM ubuntu:focal
+
+RUN apt-get update && apt-get install -y locales && \
+    localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 && \
+    rm -rf /var/lib/apt/lists/*
+ENV LANG en_US.utf8
+RUN apt-get update && DEBIAN_FRONTEND=noninteractive TZ=UTC apt-get install -y tzdata && \
+    rm -rf /var/lib/apt/lists/*
+RUN apt-get update && apt-get install -y fig2ps inkscape xfig graphviz psutils \
+    texlive-publishers texlive-pstricks texlive-science texlive-fonts-extra \
+    make nano vim git && \
+    rm -rf /var/lib/apt/lists/*
+COPY steel-city-comic.regular.ttf /usr/local/share/fonts/steel-city-comic.regular.ttf
+RUN fc-cache /usr/local/share/fonts/
+VOLUME /work
+WORKDIR /work
docker/steel-city-comic.regular.ttf new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..8e78fb3be367fa19516664d5086322cf0774c711
GIT binary patch
Signature · 1 line
2.17.1
#2 lore raw

PATCH 2/2 FAQ-BUILD: Add Q&A on Docker image

In reply to Akira Yokosawa

From 165d967a252652e2ef5af82ce62536dbcf314600 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Wed, 6 Jan 2021 19:03:55 +0900
Subject: [PATCH 2/2 -perfbook] FAQ-BUILD: Add Q&A on Docker image

The template Dockerfile and the usage explained is a tutorial level. Suggestions from Docker-savvy people are more than welcome.

---
 FAQ-BUILD.txt | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
FAQ-BUILD.txt +22 -0
index 2eeb9fbb..d4c18424 100644
@@ -273,3 +273,25 @@
 
 		    sudo updmap-sys --syncwithtrees --force
 		    sudo updmap-sys
+
+14.	I want a stable environment to build perfbook.pdf.
+	Isn't some container image available in that regard?
+
+	A.	You can find a template Dockerfile under the docker/
+		subdirectory.
+		A docker image built from it can be pulled by:
+
+		    docker pull akiyks/perfbook-build-env:focal
+
+		It can be run with the command:
+
+		    docker run --rm -it -v <path to perfbook dir>:/work \
+		      akiyks/perfbook-build-env:focal bash
+
+		Note:
+		    The directory to be mounted to /work you give to the
+		    "-v" option should be a newly cloned git repository.
+		    You should avoid using any git command from the container
+		    that might modify repository meta data and change their
+		    owner.
+		    Git operations should be done from the host side.
Signature · 1 line
2.17.1
#3 lore raw

Re: [PATCH 2/2 -perfbook] FAQ-BUILD: Add Q&A on Docker image

Quoted 25 lines · Akira Yokosawa

From 165d967a252652e2ef5af82ce62536dbcf314600 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Wed, 6 Jan 2021 19:03:55 +0900
Subject: [PATCH 2/2 -perfbook] FAQ-BUILD: Add Q&A on Docker image

The template Dockerfile and the usage explained is a tutorial level. Suggestions from Docker-savvy people are more than welcome.

---
 FAQ-BUILD.txt | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
FAQ-BUILD.txt +4 -0
index 2eeb9fbb..d4c18424 100644
@@ -273,3 +273,25 @@
 
 		    sudo updmap-sys --syncwithtrees --force
 		    sudo updmap-sys
+
+14.	I want a stable environment to build perfbook.pdf.
+	Isn't some container image available in that regard?
+

FAQ-BUILD.txt line 289

Quoted 10 lines
FAQ-BUILD.txt +10 -0
+	A.	You can find a template Dockerfile under the docker/
+		subdirectory.
+		A docker image built from it can be pulled by:
+
+		    docker pull akiyks/perfbook-build-env:focal
+
+		It can be run with the command:
+
+		    docker run --rm -it -v <path to perfbook dir>:/work \
+		      akiyks/perfbook-build-env:focal bash

If we add a "-u" option specifying host-side uid:gid to run the container, it is safe to do Git operations from inside the container.
This is because the container does all the I/O to the mounted host directory. So the following note can be removed.

I'll respin 2/2.

Thanks, Akira

Quoted 9 lines
FAQ-BUILD.txt +8 -0
+
+		Note:
+		    The directory to be mounted to /work you give to the
+		    "-v" option should be a newly cloned git repository.
+		    You should avoid using any git command from the container
+		    that might modify repository meta data and change their
+		    owner.
+		    Git operations should be done from the host side.
#4 lore raw

Re: [PATCH 2/2 -perfbook] FAQ-BUILD: Add Q&A on Docker image

Quoted 42 lines · Akira Yokosawa
Quoted 25 lines · Akira Yokosawa

From 165d967a252652e2ef5af82ce62536dbcf314600 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Wed, 6 Jan 2021 19:03:55 +0900
Subject: [PATCH 2/2 -perfbook] FAQ-BUILD: Add Q&A on Docker image

The template Dockerfile and the usage explained is a tutorial level. Suggestions from Docker-savvy people are more than welcome.

---
 FAQ-BUILD.txt | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
FAQ-BUILD.txt +4 -0
index 2eeb9fbb..d4c18424 100644
@@ -273,3 +273,25 @@
 
 		    sudo updmap-sys --syncwithtrees --force
 		    sudo updmap-sys
+
+14.	I want a stable environment to build perfbook.pdf.
+	Isn't some container image available in that regard?
+

FAQ-BUILD.txt line 289

Quoted 10 lines
FAQ-BUILD.txt +10 -0
+	A.	You can find a template Dockerfile under the docker/
+		subdirectory.
+		A docker image built from it can be pulled by:
+
+		    docker pull akiyks/perfbook-build-env:focal
+
+		It can be run with the command:
+
+		    docker run --rm -it -v <path to perfbook dir>:/work \
+		      akiyks/perfbook-build-env:focal bash

If we add a "-u" option specifying host-side uid:gid to run the container, it is safe to do Git operations from inside the container.
This is because the container does all the I/O to the mounted host directory. So the following note can be removed.

Quoted 1 line

I'll respin 2/2.

This does look like it would be very helpful to people trying to get their environment set up!

Thanx, Paul

Quoted 11 lines

Thanks, Akira

Quoted 9 lines
FAQ-BUILD.txt +8 -0
+
+		Note:
+		    The directory to be mounted to /work you give to the
+		    "-v" option should be a newly cloned git repository.
+		    You should avoid using any git command from the container
+		    that might modify repository meta data and change their
+		    owner.
+		    Git operations should be done from the host side.
#5 lore raw

v2 cover Add Dockerfile and Q&A

In reply to Akira Yokosawa

Hi,

This is the v2 of the patch set.

The strange -nq build Paul thought he had encountered prompted me to prepare a Docker image for stable build environment. Such an environment can be helpful as a contingency plan when some package's update causes breakage in perfbook's build scripts, such as the build error recently reported by Dmitry and Felipe.

This patch set adds a Dockerfile I used and a Q&A entry in FAQ-BUILD.txt.
docker/ subdirectory also holds steel city comic font to be copied to the image.

Changes v1 -> v2:
o Add a few ARG commands in Dockerfile for custimizable uid and gid.
o Entry #14 in FAQ-BUILD.txt recommends the use of -u option to use uid:gid of host side.
o Changed dockerhub repository name to perfbook-build-focal.
o Reference #14 from #5 in FAQ-BUILD.text

Thanks, Akira
--
Akira Yokosawa (2):
Add files to build Docker image for perfbook build
FAQ-BUILD: Add Q&A on Docker image

 FAQ-BUILD.txt                       |  38 +++++++++++++++++++++++++---
 docker/Dockerfile                   |  21 +++++++++++++++
 docker/steel-city-comic.regular.ttf | Bin 0 -> 23280 bytes
 3 files changed, 56 insertions(+), 3 deletions(-)
 create mode 100644 docker/Dockerfile
 create mode 100644 docker/steel-city-comic.regular.ttf
Signature · 1 line
2.17.1
#6 lore raw

PATCH v2 1/2 Add files to build Docker image for perfbook build

From 9a7692db7e7fcafb7ba9d084cc30f918a1d7cb61 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Thu, 7 Jan 2021 20:53:27 +0900
Subject: [PATCH v2 1/2 -perfbook] Add files to build Docker image for perfbook build

Contains (not so) minimal packages to build perfbook*.pdf

---
 docker/Dockerfile                   |  21 +++++++++++++++++++++
 docker/steel-city-comic.regular.ttf | Bin 0 -> 23280 bytes
 2 files changed, 21 insertions(+)
 create mode 100644 docker/Dockerfile
 create mode 100644 docker/steel-city-comic.regular.ttf
docker/Dockerfile new file +21 -0
new file mode 100644
index 00000000..e2d23c77
@@ -0,0 +1,21 @@
+FROM ubuntu:focal
+
+RUN apt-get update && apt-get install -y locales && \
+    localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 && \
+    rm -rf /var/lib/apt/lists/*
+ENV LANG en_US.utf8
+RUN apt-get update && DEBIAN_FRONTEND=noninteractive TZ=UTC apt-get install -y tzdata && \
+    rm -rf /var/lib/apt/lists/*
+RUN apt-get update && apt-get install -y fig2ps inkscape xfig graphviz psutils \
+    texlive-publishers texlive-pstricks texlive-science texlive-fonts-extra \
+    make nano vim git && \
+    rm -rf /var/lib/apt/lists/*
+COPY steel-city-comic.regular.ttf /usr/local/share/fonts/
+RUN fc-cache /usr/local/share/fonts/
+ARG uid=1000
+ARG gid=1000
+ARG user=perfbook
+ARG group=perfbook
+RUN groupadd -g $gid $group && useradd -u $uid -g $gid -m $user
+VOLUME /work
+WORKDIR /work
docker/steel-city-comic.regular.ttf new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..8e78fb3be367fa19516664d5086322cf0774c711
GIT binary patch
Signature · 1 line
2.17.1
#7 lore raw

PATCH v2 2/2 FAQ-BUILD: Add Q&A on Docker image

In reply to Akira Yokosawa

From a439bdb6aedf1ba06600c060e865d872580b0596 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Wed, 6 Jan 2021 19:03:55 +0900
Subject: [PATCH v2 2/2 -perfbook] FAQ-BUILD: Add Q&A on Docker image

The template Dockerfile and the usage explained is a tutorial level. Suggestions from Docker-savvy people are more than welcome.

---
 FAQ-BUILD.txt | 38 +++++++++++++++++++++++++++++++++++---
 1 file changed, 35 insertions(+), 3 deletions(-)
FAQ-BUILD.txt +35 -3
index 2eeb9fbb..f6c720b8 100644
@@ -36,7 +36,11 @@
 	find it?
 
 	A.	The "pdflatex" package is a variant of Don Knuth's
-		digital typesetting program.  On Ubuntu Xenial,
+		digital typesetting program.
+		If you'd like to use a Docker container, See #14 below.
+		Otherwise, instructions follow.
+
+		On Ubuntu Xenial,
 		installing the following set of packages suffices:
 
 			texlive-latex-base texlive-latex-extra psutils
@@ -71,8 +75,10 @@
 
 		On other Linux distributions such as RHEL/CentOS and
 		Scientific Linux, where support of TeX Live packages
-		is insufficient, installing upstream TeX Live should
-		be a reasonable choice.
+		is insufficient, using a Docker container is the easiest
+		choice for you.  Again, see #14 below.
+
+		Of course, you can install upstream TeX Live.
 		See: https://www.tug.org/texlive/quickinstall.html
 
 		NOTE: In doing so, you might end up in having
@@ -273,3 +279,29 @@
 
 		    sudo updmap-sys --syncwithtrees --force
 		    sudo updmap-sys
+
+14.	I want a stable environment to build perfbook.pdf.
+	Isn't some container image available in that regard?
+
+	A.	You can find a template Dockerfile under the docker/
+		subdirectory.
+		A docker image built from it can be pulled by:
+
+		    docker pull akiyks/perfbook-build-focal:latest
+
+		It can be run with the command:
+
+		    docker run --rm -it -v <path to perfbook dir>:/work \
+		      -u $(id -u):$(id -g) \
+		      akiyks/perfbook-build-focal:latest bash
+
+		Note:
+		The prebuilt Docker image assumes <uid:pid> = <1000:1000>.
+		If you have different ids, bash prompt will be in the
+		form of "I have no name!@abcdef012345:/work$".
+		There is no problem in building perfbook.
+		If you'd like, you can build a docker image on your own.
+
+		    cd docker
+		    docker build -t <docker image tag> \
+		      --build-arg uid=$(id -u) --build-arg gid=$(id -g) .
Signature · 1 line
2.17.1
#8 lore raw
In reply to Akira Yokosawa
Quoted 15 lines · Akira Yokosawa

Hi,

This is the v2 of the patch set.

The strange -nq build Paul thought he had encountered prompted me to prepare a Docker image for stable build environment. Such an environment can be helpful as a contingency plan when some package's update causes breakage in perfbook's build scripts, such as the build error recently reported by Dmitry and Felipe.

This patch set adds a Dockerfile I used and a Q&A entry in FAQ-BUILD.txt.
docker/ subdirectory also holds steel city comic font to be copied to the image.

Quoted 8 lines

Changes v1 -> v2:
o Add a few ARG commands in Dockerfile for custimizable uid and gid.
o Entry #14 in FAQ-BUILD.txt recommends the use of -u option to use uid:gid of host side.
o Changed dockerhub repository name to perfbook-build-focal.
o Reference #14 from #5 in FAQ-BUILD.text

Thanks, Akira

Applied and pushed, thank you! I did the usual wordsmithing, so please let me know if I messed anything up.

Showing my ignorance of Docker...

My guess from reading the FAQ is that the new docker/Dockerfile is used to build a new docker image, and that it is not needed by those using your akiyks/perfbook-build-focal:latest. Is my guess correct?

Thanx, Paul

Quoted 16 lines

--
Akira Yokosawa (2):
Add files to build Docker image for perfbook build
FAQ-BUILD: Add Q&A on Docker image

 FAQ-BUILD.txt                       |  38 +++++++++++++++++++++++++---
 docker/Dockerfile                   |  21 +++++++++++++++
 docker/steel-city-comic.regular.ttf | Bin 0 -> 23280 bytes
 3 files changed, 56 insertions(+), 3 deletions(-)
 create mode 100644 docker/Dockerfile
 create mode 100644 docker/steel-city-comic.regular.ttf
Signature · 1 line
2.17.1
#9 lore raw
Quoted 23 lines · Paul E. McKenney
Quoted 22 lines · Akira Yokosawa

Hi,

This is the v2 of the patch set.

The strange -nq build Paul thought he had encountered prompted me to prepare a Docker image for stable build environment. Such an environment can be helpful as a contingency plan when some package's update causes breakage in perfbook's build scripts, such as the build error recently reported by Dmitry and Felipe.

This patch set adds a Dockerfile I used and a Q&A entry in FAQ-BUILD.txt.
docker/ subdirectory also holds steel city comic font to be copied to the image.

Changes v1 -> v2:
o Add a few ARG commands in Dockerfile for custimizable uid and gid.
o Entry #14 in FAQ-BUILD.txt recommends the use of -u option to use uid:gid of host side.
o Changed dockerhub repository name to perfbook-build-focal.
o Reference #14 from #5 in FAQ-BUILD.text

Quoted 4 lines
Quoted 1 line

Thanks, Akira

Applied and pushed, thank you! I did the usual wordsmithing, so please let me know if I messed anything up.

Thank you! Now it looks perfect.

Quoted 6 lines

Showing my ignorance of Docker...

My guess from reading the FAQ is that the new docker/Dockerfile is used to build a new docker image, and that it is not needed by those using your akiyks/perfbook-build-focal:latest. Is my guess correct?

You guessed quite right.
One advantage of docker is that once you pulled my container image, large layers installing various packages are used unmodified in a new build.
Building a image with an alternative <uid:gid> pair will take just a few seconds.
Initial pull of the image can take several minutes or longer depending on the network bandwidth.

For instructions to install Docker Engine on Ubuntu, see:
https://docs.docker.com/engine/install/ubuntu/.

The command in the FAQ assumes your user id belong to the "docker" group. Otherwise, every docker command needs "sudo".

One thing you need to care is the disk capacity under /var/lib/docker.

If you are behind a corporate proxy, you need to setup proxy for docker service. See: https://docs.docker.com/network/proxy/

Thanks, Akira

Quoted 19 lines

Thanx, Paul

Quoted 16 lines

--
Akira Yokosawa (2):
Add files to build Docker image for perfbook build
FAQ-BUILD: Add Q&A on Docker image

 FAQ-BUILD.txt                       |  38 +++++++++++++++++++++++++---
 docker/Dockerfile                   |  21 +++++++++++++++
 docker/steel-city-comic.regular.ttf | Bin 0 -> 23280 bytes
 3 files changed, 56 insertions(+), 3 deletions(-)
 create mode 100644 docker/Dockerfile
 create mode 100644 docker/steel-city-comic.regular.ttf
Signature · 1 line
2.17.1