Improve Docker scripts to support any project
- Great for testing Elixir on smaller projects Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
This commit is contained in:
parent
fb5bda5584
commit
65783e715a
3 changed files with 30 additions and 15 deletions
14
README.md
14
README.md
|
|
@ -131,10 +131,18 @@ Building Docker images
|
|||
----------------------
|
||||
|
||||
Docker files are provided in the "docker/" directory. To generate your own
|
||||
Docker image for indexing the Linux kernel sources (for example),
|
||||
download the "Dockerfile" file for your target distribution and run:
|
||||
Docker image for indexing the sources of a project (for example for the Musl
|
||||
project which is much faster to index that Linux), download the "Dockerfile"
|
||||
file for your target distribution and run:
|
||||
|
||||
$ docker build -t elixir --build-arg GIT_REPO_URL=git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git .
|
||||
$ docker build -t elixir --build-arg GIT_REPO_URL=git://git.musl-libc.org/musl --build-arg PROJECT=musl .
|
||||
|
||||
Then you can use your new container as follows (you get the container id from the output of "docker build"):
|
||||
|
||||
$ docker run <container-id>
|
||||
|
||||
You can the open the below URL in a browser on your host: http://172.17.0.2/musl/latest/source
|
||||
(change the container IP address if you don't get the default one)
|
||||
|
||||
Hardware requirements
|
||||
---------------------
|
||||
|
|
|
|||
|
|
@ -13,10 +13,14 @@ LABEL author="David.Southwick@cern.ch"
|
|||
USER root
|
||||
|
||||
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}"
|
||||
|
||||
|
|
@ -34,12 +38,12 @@ RUN \
|
|||
git clone https://github.com/bootlin/elixir.git /usr/local/elixir/
|
||||
|
||||
RUN \
|
||||
mkdir -p /srv/elixir-data/linux/repo && \
|
||||
mkdir -p /srv/elixir-data/linux/data && \
|
||||
git clone "${GIT_REPO_URL}" /srv/elixir-data/linux/repo/
|
||||
mkdir -p /srv/elixir-data/$PROJECT/repo && \
|
||||
mkdir -p /srv/elixir-data/$PROJECT/data && \
|
||||
git clone "${GIT_REPO_URL}" /srv/elixir-data/$PROJECT/repo/
|
||||
|
||||
ENV LXR_REPO_DIR /srv/elixir-data/linux/repo
|
||||
ENV LXR_DATA_DIR /srv/elixir-data/linux/data
|
||||
ENV LXR_REPO_DIR /srv/elixir-data/$PROJECT/repo
|
||||
ENV LXR_DATA_DIR /srv/elixir-data/$PROJECT/data
|
||||
|
||||
RUN \
|
||||
cd /usr/local/elixir/ && \
|
||||
|
|
@ -47,7 +51,6 @@ RUN \
|
|||
./update.py
|
||||
|
||||
# apache elixir config, see elixir README
|
||||
# NB: Change /linux/ to the name of the project you want as default shown
|
||||
# apache HttpProtolOptions workaround
|
||||
RUN \
|
||||
echo $'<Directory /usr/local/elixir/http/>\n\
|
||||
|
|
@ -62,7 +65,7 @@ AddHandler cgi-script .py\n\
|
|||
ServerName MY_LOCAL_IP\n\
|
||||
DocumentRoot /usr/local/elixir/http\n\
|
||||
RewriteEngine on\n\
|
||||
RewriteRule "^/$" "/linux/latest/source" [R]\n\
|
||||
RewriteRule "^/$" "/$PROJECT/latest/source" [R]\n\
|
||||
RewriteRule "^/.*/(source|ident|search)" "/web.py" [PT]\n\
|
||||
</VirtualHost>' > /etc/httpd/conf.d/000-elixir.conf \
|
||||
&& echo -e "\nHttpProtocolOptions Unsafe" >> /etc/httpd/conf/httpd.conf
|
||||
|
|
|
|||
|
|
@ -1,9 +1,13 @@
|
|||
FROM debian:latest
|
||||
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}"
|
||||
|
||||
|
|
@ -26,12 +30,12 @@ RUN \
|
|||
mkdir -p /srv/elixir-data/
|
||||
|
||||
RUN \
|
||||
mkdir -p /srv/elixir-data/linux/repo && \
|
||||
mkdir -p /srv/elixir-data/linux/data && \
|
||||
git clone "${GIT_REPO_URL}" /srv/elixir-data/linux/repo/
|
||||
mkdir -p /srv/elixir-data/$PROJECT/repo && \
|
||||
mkdir -p /srv/elixir-data/$PROJECT/data && \
|
||||
git clone "${GIT_REPO_URL}" /srv/elixir-data/$PROJECT/repo/
|
||||
|
||||
ENV LXR_REPO_DIR /srv/elixir-data/linux/repo
|
||||
ENV LXR_DATA_DIR /srv/elixir-data/linux/data
|
||||
ENV LXR_REPO_DIR /srv/elixir-data/$PROJECT/repo
|
||||
ENV LXR_DATA_DIR /srv/elixir-data/$PROJECT/data
|
||||
|
||||
RUN \
|
||||
cd /usr/local/elixir/ && \
|
||||
|
|
|
|||
Loading…
Reference in a new issue