|
1 |
| -# Use an official Python runtime as a parent image |
2 |
| -FROM python:3.12.4-slim-bookworm |
3 |
| - |
4 |
| -# Upgrade pip to the specified version or higher |
5 |
| -RUN pip install --no-cache-dir --upgrade 'pip>=24.0' |
6 |
| - |
7 |
| -# try to upgrade to a more recent version of openssl |
8 |
| -RUN apt-get update |
9 |
| -RUN apt-get -y upgrade openssl |
10 |
| - |
11 |
| -# install jq |
12 |
| -RUN apt-get -y install jq |
13 |
| - |
14 |
| -# RUN sudo echo 'nameserver 8.8.8.8'>/etc/resolv.conf |
15 |
| -RUN apt-get update -y |
16 |
| -RUN apt-get install apt-file -y |
17 |
| -RUN apt-file update |
18 |
| -RUN apt-get install -y python3-dev build-essential |
19 |
| -RUN apt-get install -y procps |
20 |
| -RUN apt-get install -y libpq-dev |
21 |
| - |
22 |
| -RUN pip install --no-cache-dir --upgrade pip |
23 |
| -RUN pip install --no-cache-dir --upgrade grpcio |
24 |
| - |
25 |
| -ADD requirements.txt . |
26 |
| -RUN pip install --no-cache-dir -r requirements.txt |
27 |
| - |
28 |
| -# install redis |
29 |
| -RUN apt-get install -y redis-server |
30 |
| - |
31 |
| -# install requirements |
32 |
| -RUN python -m spacy download en_core_web_lg |
33 |
| -RUN python -m nltk.downloader stopwords |
34 |
| -RUN python -m nltk.downloader punkt |
35 |
| - |
36 |
| -# Copy Swirl App to container |
37 |
| -RUN mkdir /app |
| 1 | +FROM python:3.12.5-slim-bookworm |
| 2 | + |
| 3 | +# Update, upgrade and install packages in a single RUN to reduce layers |
| 4 | +RUN apt-get update && apt-get install -y \ |
| 5 | + apt-file \ |
| 6 | + build-essential \ |
| 7 | + jq \ |
| 8 | + libpq-dev \ |
| 9 | + procps \ |
| 10 | + python3-dev \ |
| 11 | + redis-server \ |
| 12 | +&& apt-file update \ |
| 13 | +&& apt-get clean \ |
| 14 | +&& rm -rf /var/lib/apt/lists/* |
| 15 | + |
| 16 | +# Copy application files (see .dockerignore for list of exclusions) |
| 17 | +COPY . /app |
38 | 18 | COPY ./db.sqlite3.dist /app/db.sqlite3
|
39 | 19 | COPY ./.env.docker /app/.env
|
40 |
| -COPY ./install-ui.sh /app/install-ui.sh |
41 |
| -ADD ./swirl /app/swirl |
| 20 | +COPY ./download-nltk-resources.sh /app/ |
42 | 21 |
|
43 |
| -# Install Galaxy UI |
44 |
| -RUN mkdir -p /app/swirl/static/galaxy |
45 |
| -COPY --from=swirlai/spyglass:latest /usr/src/spyglass/ui/dist/spyglass/browser/. /app/swirl/static/galaxy |
46 |
| -COPY --from=swirlai/spyglass:latest /usr/src/spyglass/ui/config-swirl-demo.db.json /app/ |
| 22 | +WORKDIR /app |
47 | 23 |
|
48 |
| -ADD ./swirl_server /app/swirl_server |
49 |
| -ADD ./SearchProviders /app/SearchProviders |
50 |
| -ADD ./DevUtils /app/DevUtils |
51 |
| -ADD ./Data /app/Data |
52 |
| -ADD ./uploads /app/uploads |
53 |
| -ADD ./swirl.py /app/swirl.py |
54 |
| -ADD ./swirl_load.py /app/swirl_load.py |
55 |
| -ADD ./manage.py /app/manage.py |
| 24 | +# Optimize pip and Python installations |
| 25 | +RUN pip install --no-cache-dir --upgrade pip \ |
| 26 | + && pip install --no-cache-dir -r requirements.txt \ |
| 27 | + && pip install --no-cache-dir --upgrade grpcio |
56 | 28 |
|
57 |
| -WORKDIR /app |
| 29 | +# Swirl install requirements |
| 30 | +RUN python -m spacy download en_core_web_lg && \ |
| 31 | + ./download-nltk-resources.sh |
| 32 | + |
| 33 | +# Install the Galaxy UI |
| 34 | +COPY --from=swirlai/spyglass:preview /usr/src/spyglass/ui/dist/spyglass/browser/. /app/swirl/static/galaxy |
| 35 | +COPY --from=swirlai/spyglass:preview /usr/src/spyglass/ui/config-swirl-demo.db.json /app/ |
58 | 36 |
|
59 | 37 | EXPOSE 8000
|
0 commit comments