algorithm-archive
algorithm-archive copied to clipboard
Add a docker build option to the 'How to contribute' wiki
By running the command docker run --rm -v "$PWD:/gitbook" -p 4000:4000 billryan/gitbook gitbook install && gitbook serve
one can entirely circumvent installing node.js and gitbook. Maybe this should be added as an alternative to the wiki explaining how to contribute?
The command is probably not perfect as one needs to install
everytime one wants to serve
which increases build time. I didn't quickly find a way around that. Maybe somebody else can?
I would recommend using docker compose
command as it allows a bit easier access to machine and managing it separately.
With that, unless I'm mistaken, you can make build process for docker image, which installs gitbook and next runs only invoke serve
command.
I don't see how docker-compose
helps in this case, but feel free to post instructions on how to build AAA with it.
I can look at setting this up if we are still interested
I’d probably implement it as a dev container
Related: https://github.com/algorithm-archivists/algorithm-archive/issues/691#issuecomment-905642508
Here's my first pass on a handful of languages. It's not perfect but may help others so I'm putting it here for now. Will open a PR with more languages soonish.
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.187.0/containers/ubuntu/.devcontainer/base.Dockerfile
# [Choice] Ubuntu version: bionic, focal
ARG VARIANT="focal"
FROM mcr.microsoft.com/vscode/devcontainers/base:0-${VARIANT}
# [Optional] Uncomment this section to install additional OS packages.
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends build-essential software-properties-common g++ sbcl julia python3 python3-pip python3-dev ghc openjdk-11-jdk rustc libssl-dev gfortran libxml2-dev libyaml-dev libgmp-dev libz-dev libncurses5 gnuplot nodejs npm
# Setup Crystal
RUN echo 'deb http://download.opensuse.org/repositories/devel:/languages:/crystal/xUbuntu_20.04/ /' | sudo tee /etc/apt/sources.list.d/devel:languages:crystal.list
RUN curl -fsSL https://download.opensuse.org/repositories/devel:languages:crystal/xUbuntu_20.04/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/devel_languages_crystal.gpg > /dev/null
# Setup Dart
RUN sudo sh -c 'wget -qO- https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -'
RUN sudo sh -c 'wget -qO- https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list'
# Setup Powershell
RUN sudo sh -c 'wget -q https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb -O packages-microsoft-prod.deb'
RUN sudo sh -c 'dpkg -i packages-microsoft-prod.deb'
# Setup Clojure
RUN sudo sh -c 'curl -O https://download.clojure.org/install/linux-install-1.10.3.967.sh'
RUN sudo sh -c 'chmod +x linux-install-1.10.3.967.sh'
RUN sudo sh -c 'sudo ./linux-install-1.10.3.967.sh'
# Setup dotnet
RUN sudo sh -c 'wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb'
RUN sudo sh -c 'sudo dpkg -i packages-microsoft-prod.deb'
RUN sudo sh -c 'rm packages-microsoft-prod.deb'
# Setup D Lang
RUN sudo sh -c 'mkdir -p ~/dlang && wget https://dlang.org/install.sh -O ~/dlang/install.sh'
RUN sudo sh -c 'bash ~/dlang/install.sh'
## From Docs not needed though
# RUN sudo sh -c 'source ~/dlang/dmd-2.097.2/activate'
ENV PATH=$PATH:/root/dlang/dmd-2.097.2/linux/bin64
# Setup Go
RUN sudo sh -c 'wget -c https://dl.google.com/go/go1.14.2.linux-amd64.tar.gz -O - | sudo tar -xz -C /usr/local'
ENV PATH=$PATH:/usr/local/go/bin
# Setup Emojicode
# RUN sudo sh -c 'mkdir -p ~/emojicode && wget https://github.com/emojicode/emojicode/releases/download/v1.0-beta.2/Emojicode-1.0-beta.2-Linux-x86_64.tar.gz -O ~/emojicode/emojicode.tar.gz \
# && ls && echo "ls ~" && ls ~ && echo "ls ~/emojicode/" && ls ~/emojicode/ \
# && echo "tar -xzf ~/emojicode/emojicode.tar.gz" && tar -xzf ~/emojicode/emojicode.tar.gz \
# && echo "ls ~/emojicode" && ls ~/emojicode && echo "ls ~/emojicode/" && ls ~/emojicode/ \
# && echo "ls ~" && ls ~ && echo "cd ~/emojicode/"\
# && cd ~/emojicode/ && echo && ./install.sh'
# RUN 'wget https://github.com/emojicode/emojicode/releases/download/v1.0-beta.2/Emojicode-1.0-beta.2-Linux-x86_64.tar.gz -O emojicode.tar.gz \
# && tar -xzf emojicode.tar.gz && rm emojicode.tar.gz \
# && cd Emojicode-1.0-beta.2-Linux-x86_64 && ./install.sh \
# && cd .. && rm -r Emojicode-1.0-beta.2-Linux-x86_64'
# Setup Factor
RUN mkdir -p ~/factor && wget https://downloads.factorcode.org/releases/0.98/factor-linux-x86-64-0.98.tar.gz -O ~/factor/factor.tar.gz\
&& tar -xzf ~/factor/factor.tar.gz
# && rm ~/factor/factor.tar.gz
ENV PATH=$PATH:/root/factor/factor
# [Optional] Uncomment this section to install additional OS packages.
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends crystal dart nim powershell scala dotnet-sdk-5.0
RUN pip install wheel matplotlib numpy coconut
RUN sudo sh -c 'npm install -g typescript'
Since we have the docker container now, I believe this can be done. I am adding a hacktoberfest label to this.
I think this can also be added to the How to contribute chapter because I will be adding in the wiki contents to the chapter soon.
what is supposed to done here exactly @leios I would like to pick this up if possible.
Howdy! Write some documentation for the resources linked in Contributing.md on how to build the dockerfile, and run some of the code within the book. Some of the expectations would be that someone without docker experience could look at the docs you write and be able to build and run the container and use it to run code in the algorithm archive
Add docker run instructions to how to contribute
docker run -v $(pwd):/tmp -it ghcr.io/algorithm-archivists/aaa-langs:latest bash