commit:     b475c9df9b323eab1ad2c23d1bc0026b1de596da
Author:     John R. Graham <john_r_graham <AT> gentoo <DOT> org>
AuthorDate: Sat Dec 21 17:19:07 2019 +0000
Commit:     John R. Graham <john_r_graham <AT> gentoo <DOT> org>
CommitDate: Sun Feb  2 23:20:51 2020 +0000
URL:        https://gitweb.gentoo.org/proj/forums.git/commit/?id=b475c9df

Incremental progress on initial deployment environment.

- Modified setup-workdir script to check out the
  gentoo-docker-images repo.
- Moved the forums.Dockerfile into our repo.

Signed-off-by: John R. Graham <john_r_graham <AT> gentoo.org>

 .gitignore             |  1 +
 TODO                   | 14 +++++++-------
 misc/forums.Dockerfile | 30 ++++++++++++++++++++++++++++++
 setup-workdir.bash     | 42 +++++++++++++++++++++++++++++++++++++-----
 4 files changed, 75 insertions(+), 12 deletions(-)

diff --git a/.gitignore b/.gitignore
index 36afc36fd..71e0a966a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
 style
 phpbb
+gentoo-docker-images
 *~

diff --git a/TODO b/TODO
index 421b39ed4..cb0ac917e 100644
--- a/TODO
+++ b/TODO
@@ -1,7 +1,7 @@
-[ ] Get my Gentoo public key moved to Triton.
-[ ] Get forums repository checked out on Triton.
-[ ] Get forums.Dockerfile checked in to our repo.
-[ ] Get container repository checked out in our hierarchy. Probably set up by 
the setup-workdir script.
-[ ] Modify container to include nginx and play around until I have a working 
hello world web page.
-[ ] Get a real certificate. Look at the certs on Ceres and try to re-discover 
what was done there.
-[ ] Document the above.
+[X] JRG: Get my Gentoo public key moved to Triton.
+[X] JRG: Get forums repository checked out on Triton.
+[ ] JRG: Get forums.Dockerfile checked in to our repo.
+[X] JRG: Get container repository checked out in our hierarchy. Probably set 
up by the setup-workdir script.
+[ ] JRG: Modify container to include nginx and play around until I have a 
working hello world web page.
+[ ] JRG: Get a real certificate. Look at the certs on Ceres and try to 
re-discover what was done there.
+[ ] JRG: Document the above.

diff --git a/misc/forums.Dockerfile b/misc/forums.Dockerfile
new file mode 100644
index 000000000..24ac52992
--- /dev/null
+++ b/misc/forums.Dockerfile
@@ -0,0 +1,30 @@
+# name the portage image
+FROM gentoo/portage:latest as portage
+
+# image is based on stage3-amd64
+FROM gentoo/stage3-amd64:latest
+
+# copy the entire portage volume in
+COPY --from=portage /var/db/repos/gentoo /var/db/repos/gentoo
+
+# continue with image build ...
+RUN emerge -qv dev-lang/php
+RUN emerge -qv www-servers/apache
+RUN emerge -qv app-portage/gentoolkit
+RUN emerge -qv dev-vcs/git
+RUN emerge -qv app-editors/qemacs
+
+# FIXME:
+# Outside the container, check out the release branch of the phpBB.
+# Inside the container:
+# COPY ${path_to_phpbb} /var/www/localhost/htdocs/
+# Outside the container, check out the release branch of the Gentoo-Subsilver 
style.
+# Inside the container:
+# COPY ${path_to_style}/Gentoo-SUBSILVER 
/var/www/localhost/htdocs/styles/Gentoo-SUBSILVER
+
+# Stopgap to prove it's working:
+COPY index.html /var/www/localhost/htdocs/index.html
+COPY startup.bash /root/startup.bash
+
+CMD ["/root/startup.bash"]
+

diff --git a/setup-workdir.bash b/setup-workdir.bash
index 49608d5d9..03465060f 100755
--- a/setup-workdir.bash
+++ b/setup-workdir.bash
@@ -5,7 +5,7 @@ function setup_worktree() {
        branch="$2"
 
        if [[ -z "$branch" ]] ; then
-               echo "Error in call to setup_branch()."
+               echo "Error in call to setup_worktree()."
                exit 1
        fi
 
@@ -17,22 +17,54 @@ function setup_worktree() {
 
                echo "Adding worktree for ${directory} source from branch 
${branch} ..."
                git worktree add ${directory} ${branch}
-               let worktree_count=worktree_count+1
+               let setup_count=setup_count+1
+       else
+               echo "Worktree for ${directory} already set up."
+       fi
+}
+
+function setup_repo() {
+       repo="$1"
+
+       directory=`basename ${repo}`
+       directory=${directory%%.git}
+
+       if [[ -z "$directory" ]] ; then
+               echo "Error in call to setup_repo()."
+               exit 1
+       fi
+
+       if [[ ! -d "${directory}" ]] ; then
+               if [[ -e "${directory}" ]] ; then
+                       echo "Error: Strange repository structure found for 
directory \"${directory}\". Cannot continue with the setup."
+                       exit 1
+               fi
+
+               echo "Cloning repository ${repo} into ${directory} ..."
+               git clone ${repo}
+               if [[ ! -d "${directory}" ]] ; then
+                       echo "Error: Clone did not result in expected directory 
\"${directory}\". Cannot continue with the setup."
+                       exit 1
+               fi
+               let setup_count=setup_count+1
+       else
+               echo "Repo for ${directory} already set up."
        fi
 }
 
 # set -x
 set -e
 
-worktree_count=0
+setup_count=0
 
 setup_worktree phpbb origin/3.2.x
 setup_worktree style styles/Gentoo-SUBSILVER
+setup_repo     [email protected]:gentoo/gentoo-docker-images.git
 
-if [[ $worktree_count -eq 0 ]] ; then
+if [[ $setup_count -eq 0 ]] ; then
        echo "Working directory already set up."
 else
-       echo "Working directory setup complete."
+       echo "Working directory setup complete. ${setup_count} subdirectorues 
created."
 fi
 
 echo

Reply via email to