Skip to content

Commit 1b7edac

Browse files
committed
commit to fix line endings
1 parent 7455afb commit 1b7edac

File tree

5 files changed

+241
-30
lines changed

5 files changed

+241
-30
lines changed

tools/docker-tools/Dockerfile

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Build from the latest ubuntu release
2+
FROM ubuntu:latest AS base
3+
4+
# Install items requiring root access
5+
6+
ARG DEBIAN_FRONTEND=noninteractive
7+
RUN apt-get update && apt-get install --no-install-recommends -y \
8+
apt-utils \
9+
fswatch \
10+
g++ \
11+
git \
12+
libreadline-dev \
13+
make \
14+
npm \
15+
rbenv \
16+
wget \
17+
zlib1g-dev \
18+
&& rm -rf /var/lib/apt/lists/*
19+
20+
RUN npm install -g npm@latest
21+
RUN npm install -g browser-sync
22+
23+
# Create a user "app" so everything is not running at root
24+
RUN useradd -ms /bin/bash app
25+
USER app
26+
WORKDIR /home/app
27+
28+
# Set UTF language (assumed by jekyll)
29+
ENV LC_ALL "C.UTF-8"
30+
ENV LANG "en_US.UTF-8"
31+
ENV LANGUAGE "en_US.UTF-8"
32+
33+
# Install ruby environment
34+
RUN echo 'eval "$(rbenv init -)"' >> ~/.bashrc
35+
RUN mkdir -p "$(rbenv root)"/plugins
36+
RUN git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build
37+
# Install latest ruby
38+
RUN rbenv install $(rbenv install -l | grep -v - | tail -1)
39+
RUN rbenv global $(rbenv install -l | grep -v - | tail -1)
40+
# Install bundler in global ruby
41+
RUN (eval "$(rbenv init -)"; gem install bundler)
42+
43+
# Install conda
44+
RUN mkdir $HOME/.conda
45+
RUN wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ./miniconda.sh
46+
RUN chmod +x ./miniconda.sh
47+
# https://docs.anaconda.com/anaconda/install/silent-mode/
48+
RUN bash ./miniconda.sh -b -p ./miniconda3
49+
RUN eval "$(~/miniconda3/bin/conda shell.bash hook)"; conda init; \
50+
conda update -n base -c defaults conda
51+
52+
# build the final files
53+
FROM base AS full
54+
USER app
55+
WORKDIR /home/app
56+
57+
RUN mkdir ./install
58+
WORKDIR ./install
59+
COPY ./docs/Gemfile .
60+
COPY ./docs/Gemfile.lock .
61+
COPY ./environment.yml .
62+
COPY ./.ruby-version .
63+
64+
RUN cd ./docs; (eval "$(rbenv init -)"; \
65+
rbenv install `cat .ruby-version`; \
66+
gem install bundler; \
67+
rbenv rehash; \
68+
bundle install)
69+
70+
71+
RUN ~/miniconda3/bin/conda env create
72+
73+
ENV BASH_ENV ~/.bashrc
74+
SHELL ["/bin/bash", "-c"]
75+
76+
RUN eval "$(~/miniconda3/bin/conda shell.bash hook)"; conda activate notebook; \
77+
jupyter labextension install --no-build @ijmbarr/jupyterlab_spellchecker; \
78+
jupyter labextension install --no-build @jupyterlab/toc; \
79+
jupyter lab build; \
80+
conda deactivate
81+
82+
WORKDIR /home/app
83+
84+
EXPOSE 8888 3000 3001
85+
86+
# Add version file last to avoid cache invalidation for minor releases
87+
ADD ./tools/docker-tools/VERSION .

tools/docker-tools/README.md

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# Using the docker image
2+
3+
## Setup
4+
5+
### Install Docker
6+
If you don't already have docker installed, [install Docker](https://docs.docker.com/get-docker/).
7+
8+
### Building the docker image
9+
10+
To build the docker image, first update the VERSION variable below (please use semantic versioning). Add a [release note](#release-notes).
11+
12+
#### Using Windows PowerShell
13+
```
14+
$VERSION='1.0.0'
15+
echo $VERSION > ./tools/docker-tools/VERSION
16+
$VOLUME="sean-parent-notebook"
17+
```
18+
19+
#### Linux or macOS
20+
```
21+
VERSION="1.0.0"
22+
VOLUME="sean-parent-notebook"
23+
```
24+
25+
### Common
26+
```
27+
echo $VERSION > ./tools/docker-tools/VERSION
28+
29+
# build the base image, no-cache is used so the latest tools are installed
30+
docker build --no-cache --file ./tools/docker-tools/Dockerfile --target base --tag $VOLUME .
31+
32+
# update the docs environment
33+
docker run --mount type=bind,source="$(pwd)",target=/mnt/host --tty --interactive $VOLUME bash
34+
35+
# from docker prompt (v2.6.6 is needed until Jekyll is updated to 4.1).
36+
cd /mnt/host
37+
./tools/update.sh --lock --ruby-version 2.6.6
38+
exit
39+
40+
# build the final image
41+
docker build --file ./tools/docker-tools/Dockerfile --target full --tag $VOLUME .
42+
```
43+
44+
## Running the Docker image
45+
46+
To run the docker image, execute the following.
47+
48+
```
49+
VOLUME="sean-parent.github.io"
50+
docker run --mount type=bind,source="$(pwd)",target=/mnt/host \
51+
--tty --interactive --publish 3000-3001:3000-3001 \
52+
$VOLUME bash
53+
```
54+
55+
This should leave you at bash prompt that looks like:
56+
57+
```
58+
app@fc7590a63ba3:~$
59+
```
60+
61+
The hex number is the docker image container ID and may be different. Going forward I refer to this as the _docker_ prompt to distinguish it from the _local_ promt.
62+
63+
## Build the documentation site
64+
65+
To build or rebuild the complete documentation site locally execute the following from the docker prompt:
66+
67+
```
68+
cd /mnt/host
69+
./tools/docs/prepare.sh
70+
```
71+
72+
## Run a local server for the site
73+
74+
Once the site has been prepared, you can run it to see how it looks. From the docker promt enter:
75+
76+
```
77+
./tools/docs/start.sh
78+
```
79+
80+
To view the site, open a browser to `http://localhost:3000`. The site will auto rebuild and refresh as files are changed. The [Atom editor](https://atom.io/) has a nice [language package for markdown](https://atom.io/packages/language-markdown) that understand the YAML front matter that Jekyll uses, as well as a core package for markdown previews that uses the github style (great for editing readme files).
81+
82+
## Tips
83+
84+
If you want to open another terminal on the running image use:
85+
86+
```
87+
docker ps
88+
docker exec -it <container id> bash
89+
```
90+
91+
To test a local copy of the jekyll theme, edit the Gemfile and use:
92+
93+
```
94+
docker run --mount type=bind,source="$(pwd)",target=/mnt/host \
95+
--mount type=bind,source=$HOME/Projects/github.com/adobe/hyde-theme,target=/mnt/themes \
96+
--tty --interactive --publish 3000-3001:3000-3001 \
97+
$VOLUME bash
98+
```
99+
100+
### Release Notes
101+
102+
- 1.0.0 - Initial release for jekyll
103+
- 1.0.1 - First update

tools/docker-tools/VERSION

16 Bytes
Binary file not shown.

tools/update.sh

Lines changed: 50 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,61 @@
11
#!/bin/bash
22

3-
# export PATH="$HOME/miniconda3/bin:$PATH"
4-
# export PATH="/usr/local/opt/node@8/bin:$PATH"
3+
POSITIONAL=()
4+
OPTIONS=""
5+
while [[ $# -gt 0 ]]
6+
do
7+
key="$1"
58

6-
# export PATH="/usr/local/Caskroom/miniconda/base/bin:$PATH"
9+
case $key in
10+
-l|--lock)
11+
LOCK=YES
12+
shift # past argument
13+
;;
14+
-r|--ruby-version)
15+
if [ -n "$2" ] && [ ${2:0:1} != "-" ]; then
16+
RUBY_VERSION=$2
17+
shift 2
18+
else
19+
echo "Error: Argument for $1 is missing" >&2
20+
exit 1
21+
fi
22+
;;
23+
*) # unknown option
24+
POSITIONAL+=("$1") # save it in an array for later
25+
shift # past argument
26+
;;
27+
esac
28+
done
29+
set -- "${POSITIONAL[@]}" # restore positional parameters
730

8-
cp ~/.rbenv/version .ruby-version
9-
# rbenv install $(rbenv install -l | grep -v - | tail -1)
10-
# gem install bundler
11-
# rbenv rehash
12-
(cd ./docs; bundle update)
31+
if [ -z ${RUBY_VERSION+x} ]; then
32+
rbenv local $(rbenv install -l | grep -v - | tail -1)
33+
else
34+
rbenv install $RUBY_VERSION
35+
rbenv local $RUBY_VERSION
36+
fi
1337

14-
conda env create
38+
gem install bundler
39+
rbenv rehash
40+
41+
cd ./docs
42+
rm ./Gemfile.lock
43+
44+
if [[ $LOCK = YES ]]; then
45+
bundle lock --update
46+
else
47+
bundle update
48+
fi
49+
50+
cd -
51+
52+
conda update conda -c conda-forge
1553
conda env update
54+
55+
git submodule update --recursive --remote
56+
1657
(
1758
eval "$(conda shell.bash hook)"
1859
conda activate notebook
1960
jupyter labextension update --all
2061
)
21-
22-
# brew update
23-
# brew upgrade npm
24-
# brew upgrade fswatch
25-
# npm update -g npm
26-
# npm update -g browser-sync
27-
# gem update bundler
28-
# conda update conda -c conda-forge
29-
# conda env update
30-
# git submodule update --recursive --remote
31-
#
32-
# (
33-
# eval "$(conda shell.bash hook)"
34-
# conda activate notebook
35-
# jupyter labextension update --all
36-
# )
37-
#
38-
# # create symlinks
39-
#
40-
# (cd ./docs; bundle update;)

0 commit comments

Comments
 (0)