diff --git a/Dockerfile b/Dockerfile index 8f8df9d..d8f6cd1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,19 +1,24 @@ FROM fukamachi/qlot +ARG TW_VERSION=4.1.3 +ARG TW_BIN=./bin/tailwindcss + WORKDIR /app COPY . /app RUN apt-get update && apt-get install -y --no-install-recommends build-essential curl libev-dev RUN mkdir -p ./bin \ - && curl -sLO https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-linux-x64 \ + && curl -sLO https://github.com/tailwindlabs/tailwindcss/releases/download/v${TW_VERSION}/tailwindcss-linux-x64 \ && chmod +x tailwindcss-linux-x64 \ - && mv tailwindcss-linux-x64 ./bin/tailwindcss + && mv tailwindcss-linux-x64 ${TW_BIN} -RUN ./bin/tailwindcss -i ./static/style/global.css -o ./static/style/dist.css --minify +RUN ${TW_BIN} -i ./static/style/global.css -o ./static/style/dist.css --minify -RUN qlot install --quiet +RUN qlot install --quiet --no-color + +RUN chmod +x entrypoint.sh EXPOSE 3000 -ENTRYPOINT [".qlot/bin/clackup", "--system", "hp", "--server", "woo", "--address", "0.0.0.0", "--port", "3000", "src/app.lisp"] +ENTRYPOINT ["./entrypoint.sh"] diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..8361b19 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,15 @@ +#!/bin/bash +set -e + +if [[ -n "$CLOUDFLARE_ZONE_ID" && -n "$CLOUDFLARE_API_KEY" ]]; then + echo "Purging Cloudflare cache..." + curl -s -X POST "https://api.cloudflare.com/client/v4/zones/${CLOUDFLARE_ZONE_ID}/purge_cache" \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer ${CLOUDFLARE_API_KEY}" \ + -d '{ "hosts": ["skyizwhite.dev"] }' +else + echo "Cloudflare credentials not provided. Skipping cache purge." +fi + +echo "Starting server..." +exec .qlot/bin/clackup --system hp --server woo --address 0.0.0.0 --port 3000 src/app.lisp