Make who-are-you & cl-camp4 exercises work offline

This commit is contained in:
xpetit 2020-10-31 17:27:30 +00:00
parent 4cb9d7cdf8
commit 93cc5e15b1
4 changed files with 31 additions and 1 deletions

4
sh/tests/Caddyfile Normal file
View File

@ -0,0 +1,4 @@
{$DOMAIN}
tls internal
encode zstd gzip
file_server

View File

@ -1,6 +1,22 @@
FROM debian:10.5-slim
RUN apt-get update
RUN apt-get -y install jq curl git
RUN apt-get -y install jq curl
WORKDIR /app/assets/superhero
RUN curl --remote-name --location https://demo.01-edu.org/assets/superhero/all.json
WORKDIR /tmp/installation
RUN curl --remote-name --location https://github.com/caddyserver/caddy/releases/download/v2.2.1/caddy_2.2.1_linux_amd64.tar.gz
RUN tar xf caddy_2.2.1_linux_amd64.tar.gz
RUN mv caddy /usr/local/bin
RUN apt-get -y install libcap2-bin
RUN setcap 'cap_net_bind_service=+ep' /usr/local/bin/caddy
WORKDIR /app
RUN rm -rf /tmp/installation
COPY . /app
ENTRYPOINT ["/app/entrypoint.sh"]

View File

@ -5,6 +5,9 @@ set -euo pipefail
IFS='
'
echo insecure >> ~/.curlrc
caddy start &>/dev/null
challenge() {
submitted=$(./student/myfamily.sh)
expected=$(./solutions/myfamily.sh)
@ -14,3 +17,5 @@ challenge() {
HERO_ID=1 challenge
HERO_ID=70 challenge
caddy stop &>/dev/null

View File

@ -5,7 +5,12 @@ set -euo pipefail
IFS='
'
echo insecure >> ~/.curlrc
caddy start &>/dev/null
submitted=$(./student/who-are-you.sh)
expected=$(./solutions/who-are-you.sh)
caddy stop &>/dev/null
diff <(echo "$submitted") <(echo "$expected")