Skip to content

Commit 4bcb264

Browse files
authored
Include Xapian search into docker image
1 parent fe640c6 commit 4bcb264

File tree

7 files changed

+108
-91
lines changed

7 files changed

+108
-91
lines changed

docker/dev/xapian_install.sh

Lines changed: 0 additions & 43 deletions
This file was deleted.

docker/prod/Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ ENV IN_DOCKER=1
55
ENV POETRY_VIRTUALENVS_CREATE=false
66
ENV UWSGI_PROFILE=gevent
77
ENV VIRTUAL_ENV=/venv
8+
ENV XAPIAN_VERSION=1.4.20
89

910
RUN apt-get update;
1011
RUN apt-get install -y --no-install-recommends \
@@ -22,6 +23,21 @@ ENV PATH="/venv/bin:$PATH"
2223

2324
COPY poetry.lock pyproject.toml /
2425
RUN poetry install --no-root --no-dev -vvv
26+
RUN pip install sphinx
27+
28+
# Compile & Install Xapian
29+
ADD https://oligarchy.co.uk/xapian/${XAPIAN_VERSION}/xapian-core-${XAPIAN_VERSION}.tar.xz /tmp/
30+
WORKDIR /tmp/
31+
RUN tar Jxf /tmp/xapian-core-${XAPIAN_VERSION}.tar.xz
32+
WORKDIR /tmp/xapian-core-${XAPIAN_VERSION}
33+
RUN ./configure --prefix=/venv && make && make install
34+
35+
ADD http://oligarchy.co.uk/xapian/${XAPIAN_VERSION}/xapian-bindings-${XAPIAN_VERSION}.tar.xz /tmp/
36+
WORKDIR /tmp/
37+
RUN tar Jxf /tmp/xapian-bindings-${XAPIAN_VERSION}.tar.xz
38+
WORKDIR /tmp/xapian-bindings-${XAPIAN_VERSION}
39+
RUN ./configure --prefix=/venv --with-python3 XAPIAN_CONFIG=/venv/bin/xapian-config && make && make install
40+
RUN python3 -c "import xapian; print(xapian.__version__)"
2541

2642
## STEP 2 - use slim base image
2743
FROM python:3.9-slim

docker/prod/scripts/run.bash

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ exec_migrate() {
4343
$MANAGE migrate --no-input
4444
}
4545

46+
exec_update_index() {
47+
# Create/Update search index
48+
$MANAGE update_index
49+
}
50+
4651
exec_createsuperuser() {
4752
# user envrironment variables:
4853
# (1) DJANGO_SUPERUSER_USERNAME
@@ -66,6 +71,7 @@ exec_init() {
6671
exec_collectstatic
6772
exec_migrate
6873
exec_createsuperuser
74+
exec_update_index
6975
}
7076

7177
case $CMD in
File renamed without changes.

docker/services-es.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
version: '3.7'
2+
services:
3+
db:
4+
image: postgres:13
5+
volumes:
6+
- postgres_data2:/var/lib/postgresql/data/
7+
environment:
8+
- POSTGRES_USER=${DB_USER}
9+
- POSTGRES_DB=${DB_NAME}
10+
- POSTGRES_PASSWORD=${DB_PASSWORD}
11+
ports:
12+
- 5432:5432
13+
redis:
14+
image: redis:6
15+
ports:
16+
- 6379:6379
17+
volumes:
18+
- redisdata:/data
19+
es:
20+
image: docker.elastic.co/elasticsearch/elasticsearch:7.16.2
21+
environment:
22+
- discovery.type=single-node
23+
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
24+
ports:
25+
- 9200:9200
26+
- 9300:9300
27+
volumes:
28+
- es-data:/usr/share/elasticsearch/data
29+
30+
volumes:
31+
postgres_data2:
32+
redisdata:
33+
es-data:
34+
35+
networks:
36+
my_local:
37+
driver: host

0 commit comments

Comments
 (0)