-
Notifications
You must be signed in to change notification settings - Fork 262
/
standalone.Dockerfile
91 lines (63 loc) · 2.27 KB
/
standalone.Dockerfile
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# Based on: https://github.com/cohere-ai/cohere-toolkit/blob/main/standalone.Dockerfile
FROM buildpack-deps:buster as builder
LABEL authors="rashadphz"
ENV PYTHON_VERSION=3.11.8
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PYTHONIOENCODING=utf-8
ENV LANG C.UTF-8
ENV PYTHONPATH=/workspace/src/
ENV VIRTUAL_ENV=/workspace/.venv
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
ENV POETRY_VIRTUALENVS_IN_PROJECT=true
RUN apt-get autoclean
# Install python
RUN cd /usr/src \
&& wget https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tgz \
&& tar -xzf Python-$PYTHON_VERSION.tgz \
&& cd Python-$PYTHON_VERSION \
&& ./configure --enable-optimizations \
&& make install \
&& ldconfig \
&& rm -rf /usr/src/Python-$PYTHON_VERSION.tgz /usr/src/Python-$PYTHON_VERSION \
&& update-alternatives --install /usr/bin/python python /usr/local/bin/python3 1
# Install Poetry
RUN pip3 install --no-cache-dir poetry
WORKDIR /workspace
# Copy dependency files to avoid cache invalidations
COPY pyproject.toml poetry.lock ./
# Install dependencies
RUN poetry install
# Copy the rest of the code
COPY src/backend src/backend
# Install nodejs
RUN curl -sL https://deb.nodesource.com/setup_18.x | bash - \
&& apt-get install -y nodejs \
&& npm install -g pnpm \
# pm2 to start frontend
&& npm install -g pm2
WORKDIR /workspace/src/frontend
COPY src/frontend/package.json src/frontend/pnpm-lock.yaml ./
RUN pnpm install
COPY src/frontend/ .
RUN pnpm build
# SearxNG installation
WORKDIR /workspace/searxng
# Install searxng dependencies
RUN apt-get install -y \
python3-dev python3-babel python3-venv \
uwsgi uwsgi-plugin-python3 \
git build-essential libxslt-dev zlib1g-dev libffi-dev libssl-dev
RUN git clone https://github.com/searxng/searxng.git .
RUN pip3 install -U pip setuptools wheel pyyaml
RUN pip3 install .
COPY /searxng/uwsgi.ini /workspace/searxng/uwsgi.ini
COPY /searxng/settings.yml /workspace/searxng/settings.yml
COPY /searxng/limiter.toml /workspace/searxng/limiter.toml
COPY /docker-scripts/entrypoint.sh /workspace/sbin/entrypoint.sh
COPY /docker-scripts/env-defaults /workspace/env-defaults
RUN chmod +x /workspace/sbin/entrypoint.sh
EXPOSE 8000
EXPOSE 3000
EXPOSE 8080
ENTRYPOINT ["/workspace/sbin/entrypoint.sh"]