From 90f741bebc8bcb8e6097f840edebc0ef9cbdd090 Mon Sep 17 00:00:00 2001 From: odiraneyya <66945713+odiraneyya@users.noreply.github.com> Date: Wed, 16 Mar 2022 15:12:40 +0100 Subject: [PATCH] Classroom concept, issue #313 (#314) * Classroom concept, issue #313 * Improved classroom concept documentation * Removed teaching instructions, linked to DockerHub * Update README.md * Update README.md Co-authored-by: Gary Rennie --- Dockerfile | 35 +++++++++++++++++++++++++++++++++++ README.md | 6 ++++++ 2 files changed, 41 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..7d36bf69 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,35 @@ +FROM ruby:slim + +LABEL org.opencontainers.image.authors="diraneyya@ip.rwth-aachen.de" + +RUN apt update && apt install -y git + +ENV DATA_PATH="/data" +ENV REPO_PATH="/root/githug" +ENV LEVEL_PATH="/git_hug" +ENV GITHUG_PROFILE_INPUT="$LEVEL_PATH/.profile.yml" +ENV GITHUG_HISTORY_OUTPUT="$DATA_PATH/history.txt" +ENV GITHUG_PROFILE_OUTPUT="$DATA_PATH/profile.yml" + +RUN mkdir -p $DATA_PATH +ADD . $REPO_PATH +WORKDIR $REPO_PATH +RUN gem build +RUN gem install *.gem + +WORKDIR / +RUN echo "y" | $GEM_HOME/bin/githug + +WORKDIR $LEVEL_PATH + +RUN printf "history -c\nHISTSIZE= \nHISTFILESIZE= \n\ +echo '--- NEW SESSION ---' >> $GITHUG_HISTORY_OUTPUT\n\ +export PATH=\"\$GEM_HOME/bin:\$PATH\"\ngithug reset\n" >> ~/.bashrc + +RUN printf "history -a\ncat \$HISTFILE >> $GITHUG_HISTORY_OUTPUT\n\ +cp $GITHUG_PROFILE_INPUT $GITHUG_PROFILE_OUTPUT" >> ~/.bash_logout +RUN printf ". ~/.bashrc\n" > ~/.bash_profile + +ENTRYPOINT ["/bin/bash", "--login"] +VOLUME $LEVEL_PATH +VOLUME $DATA_PATH diff --git a/README.md b/README.md index c158adbb..116ccdc9 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,10 @@ To install Githug, run If you get a complaint about permissions, you can rerun the command with `sudo`: sudo gem install githug + +#### Usage with Docker + +An unofficial _Docker_ image for this project by [@odiraneyya](https://github.com/odiraneyya) is available on ([Docker Hub](https://hub.docker.com/r/orwa84/githug)). ### Starting the Game @@ -148,3 +152,5 @@ The easiest way to test a level is: Please note that the `githug test` command can be run as `githug test --errors` to get an error stack trace from your solve method. It would be ideal if you add an integration test for your level. These tests live in `spec/githug_spec` and **must** be run in order. If you add a level but do not add a test, please add a simple `skip_level` test case similar to the `contribute` level. + +