Update Dockerfile
Browse files- Dockerfile +56 -28
Dockerfile
CHANGED
@@ -1,28 +1,56 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Step 1: Base Image & Working Directory
|
2 |
+
FROM alpine
|
3 |
+
|
4 |
+
WORKDIR /code
|
5 |
+
|
6 |
+
# Step 2: Install Dependencies
|
7 |
+
RUN apk upgrade --no-cache \
|
8 |
+
&& apk add --no-cache -t build-dependencies \
|
9 |
+
python3-dev \
|
10 |
+
py3-babel \
|
11 |
+
py3-venv \
|
12 |
+
py3-pip \
|
13 |
+
uwsgi \
|
14 |
+
uwsgi-python3 \
|
15 |
+
git \
|
16 |
+
build-base \
|
17 |
+
libxslt-dev \
|
18 |
+
zlib-dev \
|
19 |
+
libffi-dev \
|
20 |
+
openssl-dev \
|
21 |
+
shellcheck \
|
22 |
+
&& apk add --no-cache \
|
23 |
+
openssl \
|
24 |
+
bash \
|
25 |
+
su-exec
|
26 |
+
|
27 |
+
# Step 3: Create User
|
28 |
+
RUN adduser -D -H -s /bin/bash searx \
|
29 |
+
&& mkdir -p /usr/local/searx \
|
30 |
+
&& chown searx:searx /usr/local/searx
|
31 |
+
|
32 |
+
# Step 4: Clone Searx Repository
|
33 |
+
USER searx
|
34 |
+
RUN git clone https://github.com/searx/searx.git /usr/local/searx/searx-src
|
35 |
+
|
36 |
+
# Step 5: Setup Virtual Environment
|
37 |
+
RUN python3 -m venv /usr/local/searx/searx-pyenv \
|
38 |
+
&& echo ". /usr/local/searx/searx-pyenv/bin/activate" >> /usr/local/searx/.profile
|
39 |
+
|
40 |
+
# Step 6: Install Python Dependencies
|
41 |
+
RUN . /usr/local/searx/searx-pyenv/bin/activate \
|
42 |
+
&& pip install -U pip setuptools wheel pyyaml \
|
43 |
+
&& pip install -e /usr/local/searx/searx-src
|
44 |
+
|
45 |
+
# Step 7: Configuration
|
46 |
+
USER root
|
47 |
+
RUN mkdir -p /etc/searx \
|
48 |
+
&& cp /usr/local/searx/searx-src/utils/templates/etc/searx/use_default_settings.yml /etc/searx/settings.yml \
|
49 |
+
&& sed -i -e "s/ultrasecretkey/$(openssl rand -hex 16)/g" /etc/searx/settings.yml \
|
50 |
+
&& sed -i -e "s/{instance_name}/searx@$(uname -n)/g" /etc/searx/settings.yml
|
51 |
+
|
52 |
+
# Step 8: Start Searx
|
53 |
+
USER searx
|
54 |
+
CMD . /usr/local/searx/searx-pyenv/bin/activate && \
|
55 |
+
export SEARX_SETTINGS_PATH=/etc/searx/settings.yml && \
|
56 |
+
python /usr/local/searx/searx-src/searx/webapp.py
|