From 6c3c12ebba8921d9f7afc66681073aec5500a809 Mon Sep 17 00:00:00 2001 From: Andrei Jiroh Halili Date: Fri, 31 Mar 2023 16:14:39 +0000 Subject: [PATCH] build(docker): :green_heart: add custom entrypoint script to our CI image This should be also suitable for local development via Docker too. Signed-off-by: Andrei Jiroh Halili --- .vscode/settings.json | 3 ++- docker/Dockerfile | 12 +++++++++--- docker/entrypoint.sh | 11 +++++++++++ 3 files changed, 22 insertions(+), 4 deletions(-) create mode 100755 docker/entrypoint.sh diff --git a/.vscode/settings.json b/.vscode/settings.json index e8b4117..0b64f86 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -14,7 +14,8 @@ "readme", "meta", "global", - "deps-dev" + "deps-dev", + "docker" ], "conventionalCommits.autoCommit": false, "conventionalCommits.promptCI": true, diff --git a/docker/Dockerfile b/docker/Dockerfile index f44fd46..0ad6a79 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,14 +1,20 @@ FROM squidfunk/mkdocs-material # https://squidfunk.github.io/mkdocs-material/setup/setting-up-social-cards/#linux but for Alpine -RUN apk add \ +RUN apk add --no-cache \ cairo-dev \ freetype-dev \ libffi-dev \ jpeg-dev \ libpng-dev \ - zlib-dev + zlib-dev \ + bash \ + coreutils RUN pip3 install \ mkdocs-git-revision-date-localized-plugin \ pillow \ - cairosvg \ No newline at end of file + cairosvg + +COPY entrypoint.sh /usr/local/bin/entrypoint.sh +ENTRYPOINT [ "/usr/local/bin/entrypoint.sh" ] +CMD [ "serve" ] \ No newline at end of file diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh new file mode 100755 index 0000000..d421cea --- /dev/null +++ b/docker/entrypoint.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +if [[ $DEBUG != "" ]]; then + set -x +fi + +if [[ $1 = "serve" ]] || [[ $1 == "build" ]] | [[ $1 == "gh-deploy" ]] || [[ $1 == "new" ]]; then + exec mkdocs $@ +else + $@ +fi