Compare commits
No commits in common. "8d048e5094c20a51feba228769223b60fba8cd60" and "4cecc817723f72c919a2cc71d00f789ceb717fd7" have entirely different histories.
8d048e5094
...
4cecc81772
4 changed files with 10 additions and 53 deletions
|
|
@ -4,10 +4,4 @@ The build files of an nginx:alpine mkdocs container that fetches from git.
|
||||||
|
|
||||||
## Building with Podman
|
## Building with Podman
|
||||||
|
|
||||||
The containerfile of either `mkdocs-git` or `mkdocs-git-multilang` can be build with [podman](https://podman.io/) by executing the following in the working directory (either `mkdocs-git/monolang` or `mkdocs-git/multilang`):
|
|
||||||
|
|
||||||
``` shell-session
|
|
||||||
sh$ podman build --network=pasta -f mkdocs-git.containerfile -t mkdocs-git:latest
|
|
||||||
```
|
|
||||||
|
|
||||||
An mkdocs-git container may then be deployed by specifying the git repository URL in the `GIT_REPO_URL` environment variable and additionally for the multilang version the list of languages in the `WIKI_LANG` environment variable.
|
|
||||||
|
|
@ -1,18 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# Redirect standard error to standard output
|
|
||||||
exec 2>&1
|
exec 2>&1
|
||||||
|
|
||||||
# Activate the Python virtual environment
|
|
||||||
source ${VIRTUAL_ENV}/bin/activate
|
|
||||||
|
|
||||||
# Check if the /mkdocs/repo directory exists
|
|
||||||
# If it does not exist, clone the repository from the specified GIT_REPO_URL
|
|
||||||
find /mkdocs/repo || git clone $GIT_REPO_URL /mkdocs/repo
|
find /mkdocs/repo || git clone $GIT_REPO_URL /mkdocs/repo
|
||||||
|
|
||||||
# Change directory to the cloned repository and pull the latest changes
|
|
||||||
cd /mkdocs/repo && git pull
|
cd /mkdocs/repo && git pull
|
||||||
|
|
||||||
# Build mkdocs using the configuration file located at /mkdocs/repo/mkdocs.yml
|
|
||||||
# The output will be directed to /usr/share/nginx/html
|
|
||||||
exec mkdocs build -f /mkdocs/repo/mkdocs.yml -d /usr/share/nginx/html
|
exec mkdocs build -f /mkdocs/repo/mkdocs.yml -d /usr/share/nginx/html
|
||||||
|
|
@ -1,20 +1,9 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# Redirect standard error to standard output
|
|
||||||
exec 2>&1
|
exec 2>&1
|
||||||
|
|
||||||
# Activate the Python virtual environment
|
|
||||||
source ${VIRTUAL_ENV}/bin/activate
|
|
||||||
|
|
||||||
# Check if the /mkdocs/repo directory exists
|
|
||||||
# If it does not exist, clone the repository from the specified GIT_REPO_URL
|
|
||||||
find /mkdocs/repo || git clone $GIT_REPO_URL /mkdocs/repo
|
find /mkdocs/repo || git clone $GIT_REPO_URL /mkdocs/repo
|
||||||
|
|
||||||
# Change directory to the cloned repository and pull the latest changes
|
|
||||||
cd /mkdocs/repo && git pull
|
cd /mkdocs/repo && git pull
|
||||||
|
|
||||||
# Build mkdocs using the configuration file of each lang
|
|
||||||
# The output will be directed the subsequent lang directory in /usr/share/nginx/html
|
|
||||||
for lang in $WIKI_LANG
|
for lang in $WIKI_LANG
|
||||||
do
|
do
|
||||||
mkdocs build -f /mkdocs/repo/config/${lang}/mkdocs.yml -d /usr/share/nginx/html/${lang}
|
mkdocs build -f /mkdocs/repo/config/${lang}/mkdocs.yml -d /usr/share/nginx/html/${lang}
|
||||||
|
|
|
||||||
|
|
@ -1,39 +1,25 @@
|
||||||
FROM nginx:alpine
|
FROM nginx:alpine
|
||||||
|
|
||||||
# Set environment variables
|
|
||||||
ENV PORT="80"
|
ENV PORT="80"
|
||||||
ENV VIRTUAL_ENV="/mkdocs"
|
|
||||||
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
|
|
||||||
|
|
||||||
# Install necessary packages
|
|
||||||
RUN apk add --no-cache git python3 envsubst
|
|
||||||
|
|
||||||
# Create work directory
|
|
||||||
RUN mkdir /mkdocs
|
|
||||||
WORKDIR /mkdocs
|
|
||||||
|
|
||||||
# Create virtual environment
|
|
||||||
RUN python -m venv $VIRTUAL_ENV
|
|
||||||
|
|
||||||
# Install necessary packages in virtual environment
|
|
||||||
RUN pip install --no-cache-dir mkdocs mkdocs-material
|
|
||||||
|
|
||||||
# Configure nginx environment
|
|
||||||
COPY default.conf.env /etc/nginx/conf.d/default.conf.env
|
COPY default.conf.env /etc/nginx/conf.d/default.conf.env
|
||||||
|
|
||||||
# Configure entrypoints
|
RUN apk add envsubst \
|
||||||
RUN touch /docker-entrypoint.d/port.sh \
|
&& touch /docker-entrypoint.d/port.sh \
|
||||||
&& echo "exec envsubst < /etc/nginx/conf.d/default.conf.env > /etc/nginx/conf.d/default.conf && nginx -s reload" > /docker-entrypoint.d/port.sh \
|
&& echo "exec envsubst < /etc/nginx/conf.d/default.conf.env > /etc/nginx/conf.d/default.conf && nginx -s reload" > /docker-entrypoint.d/port.sh \
|
||||||
&& chmod 776 /docker-entrypoint.d/port.sh
|
&& chmod 776 /docker-entrypoint.d/port.sh
|
||||||
|
|
||||||
# Configure cron
|
RUN apk add git \
|
||||||
COPY root /etc/crontabs/root
|
&& apk add mkdocs \
|
||||||
|
&& apk add mkdocs-material \
|
||||||
|
&& apk add py3-regex
|
||||||
|
|
||||||
# Configure mkdocs-git-multilang
|
RUN mkdir /mkdocs
|
||||||
|
WORKDIR /mkdocs
|
||||||
|
|
||||||
|
COPY root /etc/crontabs/root
|
||||||
COPY mkdocs-git-multilang /bin/mkdocs-git-multilang
|
COPY mkdocs-git-multilang /bin/mkdocs-git-multilang
|
||||||
RUN chmod 744 /bin/mkdocs-git-multilang
|
RUN chmod 744 /bin/mkdocs-git-multilang
|
||||||
|
|
||||||
# Configure cron entrypoints
|
|
||||||
RUN touch /docker-entrypoint.d/cron.sh \
|
RUN touch /docker-entrypoint.d/cron.sh \
|
||||||
&& echo "exec crond" > /docker-entrypoint.d/cron.sh \
|
&& echo "exec crond" > /docker-entrypoint.d/cron.sh \
|
||||||
&& chmod 776 /docker-entrypoint.d/cron.sh
|
&& chmod 776 /docker-entrypoint.d/cron.sh
|
||||||
Loading…
Add table
Add a link
Reference in a new issue