This commit is contained in:
Armin Friedl 2020-12-15 03:52:07 +01:00
commit f420a35fe0
4 changed files with 101 additions and 0 deletions

47
Dockerfile Normal file
View file

@ -0,0 +1,47 @@
FROM debian
# Prepare image and install dependencies
ENV LANG=C.UTF-8
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y flex bison build-essential \
csh libxaw7-dev wget \
libc6-i386 default-jdk
# Install student dist
# Note that this is _not_ what is in the `/usr/class/cs143` subdirectory in the
# VM! The `cs143` contains make files that generate the assignments in an
# arbitrary folder from skeleton files. Essentially this step was already done
# in the `student-dist.tar.gz`. The assignments just have to be completed and
# submitted in the respective /class/assignments/PA* subdirectories.
# Prepare the immutable distribution
RUN mkdir -p /usr/class \
&& wget https://courses.edx.org/asset-v1:StanfordOnline+SOE.YCSCS1+1T2020+type@asset+block@student-dist.tar.gz -P /tmp \
&& tar xzf "/tmp/asset-v1:StanfordOnline+SOE.YCSCS1+1T2020+type@asset+block@student-dist.tar.gz" -C /usr/class
ENV PATH=/usr/class/bin:$PATH
# Download submission scripts
RUN wget -O - https://courses.edx.org/asset-v1:StanfordOnline+SOE.YCSCS1+1T2020+type@asset+block@pa1-grading.pl \
| tee /usr/class/assignments/PA2J/grade.pl /usr/class/assignments/PA2/grade.pl > /dev/null
RUN wget -O - https://courses.edx.org/asset-v1:StanfordOnline+SOE.YCSCS1+1T2020+type@asset+block@pa2-grading.pl \
| tee /usr/class/assignments/PA3J/grade.pl /usr/class/assignments/PA3/grade.pl > /dev/null
RUN wget -O - https://courses.edx.org/asset-v1:StanfordOnline+SOE.YCSCS1+1T2020+type@asset+block@pa3-grading.pl \
| tee /usr/class/assignments/PA4J/grade.pl /usr/class/assignments/PA4/grade.pl > /dev/null
RUN wget -O - https://courses.edx.org/asset-v1:StanfordOnline+SOE.YCSCS1+1T2020+type@asset+block@pa4-grading.pl \
| tee /usr/class/assignments/PA5J/grade.pl /usr/class/assignments/PA5/grade.pl > /dev/null
# Setup working directory
RUN mkdir -p /class
WORKDIR /class
# Run entrypoint to connect working directory to mounted host volume
COPY entrypoint.sh /usr/bin/entrypoint.sh
ENTRYPOINT ["entrypoint.sh"]
CMD ["/bin/bash"]

44
README.md Normal file
View file

@ -0,0 +1,44 @@
# Lukewarm and the Cool
One day [Cool](https://en.wikipedia.org/wiki/Cool_(programming_language))
compiled another
[`fact`](https://en.wikipedia.org/wiki/Cool_(programming_language)#Examples) and
suddenly got very sad. It was about its buddy
[Bodhi](https://www.bodhilinux.com/). Bodhi 1.4.0 (!!) was ancient and tired.
Its mirrors broke a long time ago an it just wanted to retire.
Cool on the other hand was still full of verve and vim. So it went looking for a
new companion. Soon enough Lukewarm entered its life. Lukewarm was a slick,
quick-witted, up-to-date container and they immediately got along well.
They lived happily ever after. The End.
![](luke.png)
_Totally unrelated image of a cowboy from [pngwing.com](https://www.pngwing.com/en/free-png-ydaxh)_
# Uhm?!
In short: If you are working through the [edX
Compilers](https://www.edx.org/course/compilers) course you probably want
Lukewarm instead of the Bodhi VM. It provides all the tools you need for
developing your Cool compiler in an up-to-date container image.
# Features
Lukewarm is tailored for working through the Cool assignments. It also has
several improvements over the provided [Bhodi](https://www.bodhilinux.com/) VM:
- All dependencies are pre-installed
- All `Cool` tools, scripts and binaries
- Grading scripts are pre-installed and can be executed directly (no workarounds
like in the VM)
- Work locally with your favourite tools, then compile and submit from within
the container
- Predictable and lightweight
- Use it with CI/CD
- It's based on an up-to-date debian image so you can `apt-get` what you need
# Usage
```shell
docker run -it -v $PWD:/class arminfriedl/lukewarm
```
At first start this will set up all assignments in `$PWD`.

10
entrypoint.sh Executable file
View file

@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -euo pipefail
# Copy immutable dist to work folder if it exists and is empty
if [ -d "/class" ] && [ -z "$(ls -A /class)" ]; then
cp -R /usr/class/* /class/
fi
exec "$@"

BIN
luke.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB