diff --git a/labs/lab8-dockerfiles.pdf b/labs/lab8-dockerfiles.pdf index 4abd8a0146313016fec86b189138be319f254748..e6d8bdfa4d371e0aff12fb046cebf5692cb923e5 100644 Binary files a/labs/lab8-dockerfiles.pdf and b/labs/lab8-dockerfiles.pdf differ diff --git a/labs/lab8-solutions/ex02/Dockerfile.darkhttpd.v1 b/labs/lab8-solutions/ex02/Dockerfile.darkhttpd.v1 new file mode 100644 index 0000000000000000000000000000000000000000..2b6a7842af133fbd887d7d5fcf43a1899519be05 --- /dev/null +++ b/labs/lab8-solutions/ex02/Dockerfile.darkhttpd.v1 @@ -0,0 +1,5 @@ +FROM alpine:3.21 +RUN apk update && apk add darkhttpd +RUN mkdir /var/www/darkhttpd +COPY index.html /var/www/darkhttpd +CMD ["darkhttpd", "/var/www/darkhttpd", "--port", "2000"] diff --git a/labs/lab8-solutions/ex02/Dockerfile.darkhttpd.v2 b/labs/lab8-solutions/ex02/Dockerfile.darkhttpd.v2 new file mode 100644 index 0000000000000000000000000000000000000000..bd7d01a9bf47874f832cec841705e8aae821434e --- /dev/null +++ b/labs/lab8-solutions/ex02/Dockerfile.darkhttpd.v2 @@ -0,0 +1,8 @@ +FROM alpine:3.21 +RUN apk update +RUN apk add darkhttpd +RUN adduser -S -D -H www +RUN mkdir -p /var/www/darkhttpd +COPY index.html /var/www/darkhttpd +USER www +CMD ["darkhttpd", "/var/www/darkhttpd", "--port", "2000"] diff --git a/labs/lab8-solutions/ex02/Dockerfile.darkhttpd.v3 b/labs/lab8-solutions/ex02/Dockerfile.darkhttpd.v3 new file mode 100644 index 0000000000000000000000000000000000000000..02f7f5e13606388273676ae20d5d0656fadd0f7f --- /dev/null +++ b/labs/lab8-solutions/ex02/Dockerfile.darkhttpd.v3 @@ -0,0 +1,7 @@ +FROM alpine:3.21 +RUN apk update +RUN apk add darkhttpd +RUN adduser -S -D -H www +RUN mkdir -p /var/www/darkhttpd +USER www +CMD ["darkhttpd", "/var/www/darkhttpd", "--port", "2000"] diff --git a/labs/lab8-solutions/ex02/index.html b/labs/lab8-solutions/ex02/index.html new file mode 100644 index 0000000000000000000000000000000000000000..fd0c263e6a1a1c01205aa70f891b09d65f604ce2 --- /dev/null +++ b/labs/lab8-solutions/ex02/index.html @@ -0,0 +1,8 @@ +<!DOCTYPE html> +<html> +<body> +<h1>Welcome to darkhttpd!</h1> +<p>If you see this page, it means the darkhttpd web server is running successfully.</p> +<p>Check the project's homepage at <a href="https://unix4lyfe.org/darkhttpd/">https://unix4lyfe.org/darkhttpd/</a></p> +</body> +</html> \ No newline at end of file diff --git a/labs/lab8-solutions/ex03/Dockerfile b/labs/lab8-solutions/ex03/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..a119b2aa6cf015a7a717a2a537a5466b4146cd8a --- /dev/null +++ b/labs/lab8-solutions/ex03/Dockerfile @@ -0,0 +1,5 @@ +FROM alpine:3.21 +RUN apk update && apk add imagemagick libjpeg-turbo +WORKDIR /shared +ADD img_conv.sh /usr/local/bin +ENTRYPOINT ["sh","/usr/local/bin/img_conv.sh"] diff --git a/labs/lab8-solutions/ex03/img_conv.sh b/labs/lab8-solutions/ex03/img_conv.sh new file mode 100644 index 0000000000000000000000000000000000000000..098652bba9026889dd352ee58c5f692349225da1 --- /dev/null +++ b/labs/lab8-solutions/ex03/img_conv.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +if [ $# -lt 2 ]; then + echo "Usage: fmt images" + echo " fmt: output image format, e.g. png" + echo " images: images to convert to the specified format" + exit 0 +fi + +fmt=$1 +shift + +mogrify -format $fmt $@ diff --git a/labs/lab8-solutions/ex04/Dockerfile1 b/labs/lab8-solutions/ex04/Dockerfile1 new file mode 100644 index 0000000000000000000000000000000000000000..6a2603cc31574db730c09269caf4a5c8ff0aee52 --- /dev/null +++ b/labs/lab8-solutions/ex04/Dockerfile1 @@ -0,0 +1,16 @@ +FROM debian:12 +RUN apt-get update && apt-get install -y wget make gcc libncurses-dev && \ + cd /tmp && \ + wget https://www.alessandropira.org/alienwave/alienwave-0.4.0.tar.gz && \ + tar fxz alienwave-0.4.0.tar.gz && \ + cd /tmp/alienwave && \ + cat Makefile|sed s/"\-lncurses"/"\-lncurses -ltinfo -static"/g > Makefile2 && \ + mv Makefile2 Makefile && \ + make && \ + mv alienwave /usr/local/bin && \ + rm -rf /tmp/* && \ + apt-get remove -y wget make gcc libncurses-dev && \ + apt-get clean && \ + apt autoremove -y && \ + rm -rf /var/lib/apt/lists /var/cache/apt +CMD ["/usr/local/bin/alienwave"] diff --git a/labs/lab8-solutions/ex04/Dockerfile2 b/labs/lab8-solutions/ex04/Dockerfile2 new file mode 100644 index 0000000000000000000000000000000000000000..17e9a9e745b370b0f6da0d5c89c7aeb3fca07b16 --- /dev/null +++ b/labs/lab8-solutions/ex04/Dockerfile2 @@ -0,0 +1,16 @@ +# Builder stage +FROM debian:12 AS builder +RUN apt-get update +RUN apt-get install -y wget make gcc libncurses-dev +WORKDIR /tmp +RUN wget https://www.alessandropira.org/alienwave/alienwave-0.4.0.tar.gz && tar fxz alienwave-0.4.0.tar.gz +WORKDIR /tmp/alienwave +RUN cat Makefile|sed s/"\-lncurses"/"\-lncurses -ltinfo -static"/g > Makefile2 && mv Makefile2 Makefile +RUN make + +# Final stage which uses the builder stage +# Image size: 11.3MB +FROM alpine:latest +RUN apk update && apk add ncurses +COPY --from=builder /tmp/alienwave/alienwave /usr/bin +CMD ["/usr/bin/alienwave"] diff --git a/labs/lab8-solutions/ex05/Dockerfile1 b/labs/lab8-solutions/ex05/Dockerfile1 new file mode 100644 index 0000000000000000000000000000000000000000..56253861337a4fe59b74298c95d71ffbf3998733 --- /dev/null +++ b/labs/lab8-solutions/ex05/Dockerfile1 @@ -0,0 +1,6 @@ +FROM ubuntu:24.04 +RUN apt-get update && apt-get install -y golang ca-certificates +RUN go install github.com/alfg/asciicat@latest +RUN cp /root/go/bin/asciicat /usr/bin +WORKDIR /images +ENTRYPOINT ["asciicat", "-i"] diff --git a/labs/lab8-solutions/ex05/Dockerfile2 b/labs/lab8-solutions/ex05/Dockerfile2 new file mode 100644 index 0000000000000000000000000000000000000000..78c17339cf42634a65578266903dd6d3593800b5 --- /dev/null +++ b/labs/lab8-solutions/ex05/Dockerfile2 @@ -0,0 +1,8 @@ +FROM ubuntu:24.04 AS builder +RUN apt-get update && apt-get install -y golang ca-certificates +RUN go install github.com/alfg/asciicat@latest + +FROM alpine:3.21 +WORKDIR /images +COPY --from=builder /root/go/bin/asciicat /usr/bin +ENTRYPOINT ["asciicat", "-i"] diff --git a/labs/lab8-solutions/ex05/Dockerfile3 b/labs/lab8-solutions/ex05/Dockerfile3 new file mode 100644 index 0000000000000000000000000000000000000000..9fd7f56c9eaac7c99beb5cdda798692cf15cda36 --- /dev/null +++ b/labs/lab8-solutions/ex05/Dockerfile3 @@ -0,0 +1,5 @@ +FROM scratch +WORKDIR /bin +COPY asciicat /bin +WORKDIR /images +ENTRYPOINT ["/bin/asciicat", "-i"]