Skip to content
Snippets Groups Projects
Commit 8e11bf01 authored by Prashanth D. Rao's avatar Prashanth D. Rao
Browse files

fix conflicting commits

parents 6656bfd3 07c33d46
No related branches found
No related tags found
No related merge requests found
FROM centos:7 FROM rockylinux:9.3
RUN yum install -y git wget gcc make openssl-devel readline-devel zlib-devel vim bzip2 RUN yum -y update && yum clean all
RUN yum install -y git wget gcc make openssl-devel readline-devel zlib-devel vim bzip2 libffi-devel libyaml
RUN dnf -y group install "Development Tools"
RUN dnf config-manager --set-enabled crb
RUN yum install -y epel-release RUN yum install -y epel-release
RUN yum install -y pandoc RUN dnf install -y libyaml-devel
RUN dnf -y install perl
RUN useradd nscuser -M --shell /bin/bash RUN useradd nscuser -M --shell /bin/bash
RUN mkdir -p /home/nscuser
RUN chown -R nscuser:nscuser /home/nscuser
WORKDIR /usr/local/src WORKDIR /usr/local/src
RUN git clone https://github.com/snic-nsc/nscjekyllsetup.git RUN git clone https://github.com/snic-nsc/nscjekyllsetup.git
WORKDIR /usr/local/src/nscjekyllsetup WORKDIR /usr/local/src/nscjekyllsetup
RUN git checkout 'v1.17' RUN git checkout 'new_jekyll'
RUN bash presetup.sh RUN bash presetup.sh
RUN bash setup.sh RUN bash setup.sh
USER nscuser USER nscuser
......
# What this is
- Containerized ruby, installed within a ruby env (rbenv), and jekyll, installed within that rbenv.
- The idea is to freeze both the version of ruby and jekyll used, so a container build at a later date doesn't end up with different versions which may or may not work with the NSC web codebase.
# What is included # What is included
- The Dockerfile in this repo is used to build a docker container with Jekyll 2.1.1, under rbenv (v2.4.1), with all the required gem files, to run the NSC webpages. - Docker and Singularity recipes to install jekyll 4.3.3 under rbenv (ruby v3.3.4) and jekyll 3.9.4 under rbenv (ruby 3.0.7)
- A second rbenv (v2.4.0) is also installed and setup with Jekyll 3.4.2, and can be used to test code requiring a more current Jekyll.
- There is a script (compile.sh) which can be used if you want to generate html code for the webpage, without actually logging onto the container. - There is a script (compile.sh) which can be used if you want to generate html code for the webpage, without actually logging onto the container.
- There's also a Singularity recipe, to build a singularity container.
## Docker Installation ## Docker Installation
...@@ -34,13 +37,13 @@ ...@@ -34,13 +37,13 @@
## Scripted html code generation ## Scripted html code generation
- You can generate the html code for the files in the nscweb repo, without having to login into the container, using the compile.sh script on the container. It'll write the generated files to the _site directory, within your repo. It will output the compilation message(s) onto the terminal, and also return the exit code returned by jekyll, which can be used to test if the compilation was successful. Note that the `compile.sh` script takes an argument; if `nsc` is specified, it uses `jekyll 2.1.1`, else it will use a more current version of Jekyll, `jekyll 3.5.2`. - You can generate the html code for the files in the nscweb repo, without having to login into the container, using the compile.sh script on the container. It'll write the generated files to the _site directory, within your repo. It will output the compilation message(s) onto the terminal, and also return the exit code returned by jekyll, which can be used to test if the compilation was successful. Note that the `compile.sh` script takes an argument; if `devel` is specified, it uses `jekyll 4.3.3`, else it will use an older version of jekyll that is the default on rocky9, which is `jekyll 3.9.4`.
``` ```
sudo docker exec -it nscjekyll bash /home/nscuser/compile.sh nsc sudo docker exec -it nscjekyll bash /usr/local/src/nscjekyllsetup/compile.sh
Configuration file: /home/nscuser/mnt/_config.yml Configuration file: /mnt/_config.yml
Source: /home/nscuser/mnt Source: /mnt
Destination: /home/nscuser/mnt/_site Destination: /mnt/_site
Generating... Generating...
done. done.
``` ```
...@@ -51,11 +54,11 @@ Configuration file: /home/nscuser/mnt/_config.yml ...@@ -51,11 +54,11 @@ Configuration file: /home/nscuser/mnt/_config.yml
``` ```
sudo docker exec -it nscjekyll bash sudo docker exec -it nscjekyll bash
source rubyenv nsc source rubyenv
cd /mnt cd /mnt
jekyll serve --watch jekyll serve --host=0.0.0.0 --watch
``` ```
- At this point, if you don't see errors on the console, you should be able to point the browser on your host machine to localhost:4000 and view the pages. - At this point, if you don't see errors on the console, you should be able to point the browser on your host machine to http://127.0.0.1:4000/ and view the pages.
## Singularity installation ## Singularity installation
...@@ -68,13 +71,13 @@ sudo singularity build nscjekyll.simg Singularity ...@@ -68,13 +71,13 @@ sudo singularity build nscjekyll.simg Singularity
- To simply compile pages (such as via a script) - To simply compile pages (such as via a script)
``` ```
singularity exec --bind <checked-out nscweb directory>:/mnt nscjekyll.simg bash /usr/local/src/nscjekyllsetup/compile.sh nsc singularity exec --bind <checked-out nscweb directory>:/mnt nscjekyll.simg bash /usr/local/src/nscjekyllsetup/compile.sh
``` ```
- Run the jekyll web server, to serve pages, you could do one of the following: - Run the jekyll web server, to serve pages, you could do one of the following:
``` ```
singularity exec --bind <checked-out nscweb directory>:/mnt nscjekyll.simg bash singularity exec --bind <checked-out nscweb directory>:/mnt nscjekyll.simg bash
source /usr/local/src/nscjekyllsetup/rubyenv nsc source /usr/local/src/nscjekyllsetup/rubyenv
cd /mnt cd /mnt
jekyll serve --watch jekyll serve --watch
``` ```
...@@ -82,7 +85,7 @@ jekyll serve --watch ...@@ -82,7 +85,7 @@ jekyll serve --watch
or or
``` ```
singularity shell nscjekyll.simg singularity shell nscjekyll.simg
source /usr/local/src/nscjekyllsetup/rubyenv nsc source /usr/local/src/nscjekyllsetup/rubyenv
cd <checked-out nscweb directory> cd <checked-out nscweb directory>
jekyll serve --watch jekyll serve --watch
``` ```
......
#!/bin/bash #!/bin/bash
source /usr/local/src/nscjekyllsetup/rubyenv $1
cd /mnt cd /mnt
source /usr/local/src/nscjekyllsetup/rubyenv $1
export LANG=C.UTF-8
jekyll build; jekyll build;
exit $?; exit $?;
sudo docker tag 8f77d3f4dc1d pchengi/nscjekyll:v1.17 # to tag an existing image under a repo. sudo docker tag b7c5d841649e pchengi/nscjekyll:v2.0.0 #to tag an existing image under a repo.
sudo docker login #login to configured repo sudo docker login #login to configured repo
sudo docker tag 8f77d3f4dc1d pchengi/nscjekyll:latest # to update the latest tag sudo docker tag b7c5d841649e pchengi/nscjekyll:latest # to update the latest tag
sudo docker push pchengi/nscjekyll:v2.0.0 #push latest tag to remote repo
sudo docker push pchengi/nscjekyll:latest #push latest tag to remote repo sudo docker push pchengi/nscjekyll:latest #push latest tag to remote repo
#!/bin/bash #!/bin/bash
# Some prerequisites # Some prerequisites
echo 'export LANG=en_US.UTF-8' >>/etc/bashrc
echo 'export LC_CTYPE=en_US.UTF-8' >>/etc/bashrc
export 'RBENV_ROOT'=/usr/local/src/rbenv export 'RBENV_ROOT'=/usr/local/src/rbenv
echo "export LANG=C.UTF-8" >>/etc/bashrc
echo "export PATH=$RBENV_ROOT/bin:$PATH" >>/etc/bashrc echo "export PATH=$RBENV_ROOT/bin:$PATH" >>/etc/bashrc
export LANG=en_US.UTF-8 if [ "$1" = "devel" ]; then
export LC_CTYPE=en_US.UTF-8 export PATH=/usr/local/src/rbenv/bin:/usr/local/src/rbenv/versions/3.3.4/bin:$PATH
if [ "$1" = "nsc" ]; then
export PATH=/usr/local/src/rbenv/bin:/usr/local/src/rbenv/versions/2.4.1/bin:$PATH
else else
export PATH=/usr/local/src/rbenv/bin:/usr/local/src/rbenv/versions/2.4.0/bin:$PATH export PATH=/usr/local/src/rbenv/bin:/usr/local/src/rbenv/versions/3.0.7/bin:$PATH
fi fi
...@@ -3,22 +3,24 @@ ...@@ -3,22 +3,24 @@
cd /usr/local/src cd /usr/local/src
git clone https://github.com/sstephenson/rbenv.git rbenv git clone https://github.com/sstephenson/rbenv.git rbenv
pushd rbenv pushd rbenv
git checkout 615f8443fe947f114fb358815b50978f6ab1881c git checkout v1.3.0
popd popd
git clone https://github.com/sstephenson/ruby-build.git rbenv/plugins/ruby-build git clone https://github.com/sstephenson/ruby-build.git rbenv/plugins/ruby-build
pushd rbenv/plugins/ruby-build pushd rbenv/plugins/ruby-build
git checkout 476d09b66a14392989c3c65793428742e1d9f951 git checkout d8f64002c941a76fc4a17a68338717be019c1457
export PATH=/usr/local/src/rbenv/bin:$PATH export PATH=/usr/local/src/rbenv/bin:$PATH
export RBENV_ROOT=/usr/local/src/rbenv export RBENV_ROOT=/usr/local/src/rbenv
eval "$(rbenv init -)" eval "$(rbenv init -)"
rbenv install 2.4.1 rbenv install 3.0.7
rbenv global 2.4.1 rbenv global 3.0.7
gem update -f rdoc ri gem install -v 3.9.4 jekyll
gem install -v 2.5.3 jekyll gem install kramdown-parser-gfm
gem install pandoc-ruby RedCloth gem install webrick
rbenv install 2.4.0 #Install a secondary ruby environment and deploy a second jekyll here.
rbenv global 2.4.0 rbenv install 3.3.4
gem update -f rdoc ri rbenv global 3.3.4
gem install -v 3.5.2 jekyll gem install -v 4.3.3 jekyll
gem install pandoc-ruby pygments.rb RedCloth jekyll-feed jekyll-paginate jekyll-paginate-multiple jekyll-redirect-from jekyll-sitemap gem install kramdown-parser-gfm
gem install webrick
chmod -R ugo+rx /usr/local/src/rbenv chmod -R ugo+rx /usr/local/src/rbenv
Bootstrap: docker Bootstrap: docker
From: centos:7 From: rockylinux:9.3
%post %post
yum install -y git wget gcc make openssl-devel readline-devel zlib-devel vim bzip2 yum -y update && yum clean all
yum install -y git wget gcc make openssl-devel readline-devel zlib-devel vim bzip2 libffi-devel libyaml
dnf -y group install "Development Tools"
dnf config-manager --set-enabled crb
yum install -y epel-release yum install -y epel-release
yum install -y pandoc dnf install -y libyaml-devel
dnf -y install perl
mkdir -p /usr/local/src && cd /usr/local/src mkdir -p /usr/local/src && cd /usr/local/src
git clone https://github.com/snic-nsc/nscjekyllsetup.git git clone https://github.com/snic-nsc/nscjekyllsetup.git
cd nscjekyllsetup && git checkout 'v1.17' cd nscjekyllsetup && git checkout 'new_jekyll'
bash presetup.sh bash presetup.sh
bash setup.sh bash setup.sh
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment