diff --git a/drawpile/build.sh b/drawpile/build.sh new file mode 100755 index 0000000..2cde03d --- /dev/null +++ b/drawpile/build.sh @@ -0,0 +1,53 @@ +#!/usr/bin//env bash + +VERSION=$1 + +function require() { + if [ "$1" = "" ]; then + echo "input '$2' required" + print_help + exit 1 + fi +} + +function print_help() { + echo "container.sh" + echo "" + echo "Usage:" + echo " container.sh [version]" + echo "" + echo "Args:" + echo " version: The version of dpserver to build" +} + +function build_image() { + IMAGE=$1 + ARCH=$2 + + docker build \ + --pull \ + --no-cache \ + --build-arg "version=${VERSION}" \ + -f "Dockerfile.${ARCH}" \ + -t "${IMAGE}:${VERSION}-${ARCH}" \ + -t "${IMAGE}:latest-${ARCH}" \ + -t "${IMAGE}:latest" \ + . + + docker push "${IMAGE}:${VERSION}-${ARCH}" + docker push "${IMAGE}:latest-${ARCH}" + docker push "${IMAGE}:latest" +} + +require "$VERSION" "version" + +set -xe + +# pushd dpserver +# build_image asonix/drawpile-server arm64v8 +# popd +pushd listserver +build_image asonix/drawpile-listserver arm64v8 +popd +pushd static +build_image asonix/drawpile-static arm64v8 diff --git a/drawpile/dpserver/Dockerfile.arm64v8 b/drawpile/dpserver/Dockerfile.arm64v8 new file mode 100644 index 0000000..238c84d --- /dev/null +++ b/drawpile/dpserver/Dockerfile.arm64v8 @@ -0,0 +1,26 @@ +## Common base +FROM arm64v8/alpine:3.11.3 as common +RUN apk add --no-cache qt5-qtbase qt5-qtbase-sqlite libmicrohttpd libbz2 libsodium + +## Build container +FROM common as builder +RUN apk add qt5-qtbase-dev libmicrohttpd-dev libsodium-dev cmake make g++ +WORKDIR /build/ + +COPY build-deps.sh /build/ +RUN sh build-deps.sh + +ARG version=master +RUN wget https://github.com/drawpile/Drawpile/archive/${version}.zip -O /build/drawpile.zip +COPY build.sh /build/ +RUN sh build.sh + +## Final deployment image +FROM common +COPY --from=builder /build/drawpile-srv /bin +COPY --from=builder /build/karchive*/build/bin/libKF5* /usr/lib/ +RUN adduser -D drawpile + +EXPOSE 27750 +USER drawpile +ENTRYPOINT ["/bin/drawpile-srv"] diff --git a/drawpile/dpserver/build-deps.sh b/drawpile/dpserver/build-deps.sh new file mode 100755 index 0000000..8c490ab --- /dev/null +++ b/drawpile/dpserver/build-deps.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env sh + +wget https://github.com/KDE/extra-cmake-modules/archive/v5.55.0.zip -O ecm.zip +wget https://github.com/KDE/karchive/archive/v5.55.0.zip -O karchive.zip + +unzip ecm.zip +unzip karchive.zip + +cd /build/extra-cmake-modules-* +cmake . +make install + +cd /build/karchive-* +mkdir build +cd build +cmake .. +make +make install diff --git a/drawpile/dpserver/build.sh b/drawpile/dpserver/build.sh new file mode 100755 index 0000000..3aff815 --- /dev/null +++ b/drawpile/dpserver/build.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env sh + +unzip drawpile.zip +cd Drawpile-*/ +mkdir build +cd build +cmake .. -DCLIENT=OFF -DSERVER=ON -DSERVERGUI=OFF -DCMAKE_BUILD_TYPE=Release +make +mv bin/drawpile-srv /build/ diff --git a/drawpile/listserver/Dockerfile.arm64v8 b/drawpile/listserver/Dockerfile.arm64v8 new file mode 100644 index 0000000..7e4cb0d --- /dev/null +++ b/drawpile/listserver/Dockerfile.arm64v8 @@ -0,0 +1,10 @@ +FROM arm64v8/golang:alpine as builder +RUN apk update && apk add --no-cache git gcc libc-dev +RUN go get github.com/BurntSushi/toml crawshaw.io/sqlite github.com/gorilla/mux github.com/gorilla/handlers github.com/kelseyhightower/envconfig +WORKDIR $GOPATH/src/github.com/drawpile/listserver +COPY . . +RUN go build -o /go/bin/listserver + +FROM arm64v8/golang:alpine +COPY --from=builder /go/bin/listserver /go/bin/listserver +ENTRYPOINT ["/go/bin/listserver", "-l", "0.0.0.0:8080"] diff --git a/drawpile/static/Dockerfile.arm64v8 b/drawpile/static/Dockerfile.arm64v8 new file mode 100644 index 0000000..fd35308 --- /dev/null +++ b/drawpile/static/Dockerfile.arm64v8 @@ -0,0 +1,2 @@ +FROM arm64v8/nginx:1.17.9-alpine +COPY index.html /usr/share/nginx/html diff --git a/drawpile/static/index.html b/drawpile/static/index.html new file mode 100644 index 0000000..d838370 --- /dev/null +++ b/drawpile/static/index.html @@ -0,0 +1,28 @@ + + + + + + Drawpile | asonix.dog + + + +

Drawpile on asonix.dog

+

+ This is a free to use Drawpile server. + To host a session here, select the Remote option + in the Host dialog and enter pub.drawpile.net in the text box. +

+ +

+ This public server is provided primarily for the benefit of those who are unable to host sessions + on their own computers. It has limited capacity, so please be considerate of others and + try not to monopolize the available space. +

+ +

+ Sessions hosted (or just listed) here should abide by the + common community guidelines. +

+ +