elixir/docker/debian/Dockerfile
Théo Lebrun c8bcfc8306 docker: Fix debian/Dockerfile filepath and README doc
Two things get fixed here:

 - README says downloading Dockerfile is enough. It is not; Debian
   Dockerfile requires docker/debian/000-default.conf file.

 - docker/debian/Dockerfile links to 000-default.conf file using:

      COPY ./docker/debian/000-default.conf /etc/apache2/sites-available/000-default.conf

   This means following command in README cannot work:

      docker build [...] .

   Either you set cwd to root Git repo and Dockerfile is not found, or
   you set cwd to docker/debian/ and 000-default.conf is not found.
   Correct command would be:

      docker build -f docker/debian/Dockerfile [...] .

We fix Dockerfile by expecting 000-default.conf to be in cwd. We fix
README by rewording the paragraph and updating commands to work based
on Git repo root directory.

Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
2024-04-29 12:36:54 +02:00

79 lines
1.9 KiB
Docker

FROM debian:bookworm
ARG GIT_REPO_URL
ARG PROJECT
RUN \
: "${GIT_REPO_URL:?set GIT_REPO_URL to the repo git url}"
RUN \
: "${PROJECT:?set PROJECT to set the project name}"
RUN \
echo "repo url to index: ${GIT_REPO_URL}"
RUN \
apt-get update && \
apt-get --no-install-recommends -y install \
python3 \
python3-pip \
python3-falcon \
python3-jinja2 \
python3-bsddb3 \
python3-pytest \
python3-pygments- \
pipx \
perl \
git \
apache2 \
libapache2-mod-wsgi-py3 \
libjansson4 \
libyaml-0-2 \
wget
RUN \
wget https://bootlin.com/pub/elixir/universal-ctags_0+git20200526-0ubuntu1_amd64.deb
RUN \
dpkg -i universal-ctags_0+git20200526-0ubuntu1_amd64.deb
RUN \
wget https://bootlin.com/pub/elixir/Pygments-2.6.1.elixir-py3-none-any.whl
RUN \
pip3 install ./Pygments-2.6.1.elixir-py3-none-any.whl --break-system-packages
RUN \
git config --global user.email 'elixir@dummy.com' && \
git config --global user.name 'elixir'
RUN \
git clone https://github.com/bootlin/elixir.git /usr/local/elixir/
RUN \
mkdir -p /srv/elixir-data/ && \
mkdir -p /srv/elixir-data/$PROJECT/repo && \
mkdir -p /srv/elixir-data/$PROJECT/data && \
git clone --bare "${GIT_REPO_URL}" /srv/elixir-data/$PROJECT/repo/ && \
git config --global --add safe.directory /srv/elixir-data/$PROJECT/repo
ENV LXR_REPO_DIR /srv/elixir-data/$PROJECT/repo
ENV LXR_DATA_DIR /srv/elixir-data/$PROJECT/data
RUN \
cd /usr/local/elixir/ && \
./script.sh list-tags && \
python3 -u ./update.py && \
chown -R www-data:www-data /srv/elixir-data/$PROJECT/repo
# apache elixir config, see elixir README
# make apache less stricter about cgitb spam headers
COPY ./000-default.conf /etc/apache2/sites-available/000-default.conf
RUN \
echo -e "\nHttpProtocolOptions Unsafe" >> /etc/apache2/apache.conf && \
a2enmod cgi rewrite
EXPOSE 80
ENTRYPOINT ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]