generated from mattbrictson/gem
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
131 lines (115 loc) · 3.02 KB
/
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# Use Ruby 3.3 as the base image
FROM ruby:3.3-slim
# Create a non-root user to run the app
RUN useradd -s /bin/bash -m flowbots
# Install system dependencies
RUN apt-get update && apt-get install -y \
--no-install-recommends \
apt-transport-https \
apt-utils \
build-essential \
ca-certificates \
cmake \
curl \
dialog \
exiftool \
git \
gnupg \
gnuplot \
gpg-agent \
graphviz \
libcairo2-dev \
libczmq-dev \
libffi-dev \
libfftw3-dev \
libgdbm-dev \
libgmp-dev \
libgsl-dev \
liblink-grammar-dev \
libmagick++-dev \
libmariadb-dev-compat \
libmariadb-dev \
libncurses5-dev \
libopenblas-dev \
libplot2c2 \
libpoppler-glib-dev \
libpq-dev \
libreadline-dev \
libreoffice \
libsqlite3-dev \
libssl-dev \
libtamuanova-0.2 \
libxml2-dev \
libxslt1-dev \
libyaml-dev \
libzmq3-dev \
link-grammar \
lsb-release \
minisat \
neovim \
openssl \
pandoc \
pdftk \
pkg-config \
plotutils \
poppler-utils \
postgresql-client \
python3 \
python3-link-grammar \
python3-pip \
python3.11-venv \
rsync \
ruby-psych \
software-properties-common \
sqlite3 \
tesseract-ocr \
tidy \
tzdata \
wget \
zip \
zlib1g-dev \
&& rm -rf /var/lib/apt/lists/*
# Set the working directory in the container
WORKDIR /app
ARG USE_TRF=False
ARG USE_BOOKNLP=False
RUN python3 -m venv .venv && \
. /app/.venv/bin/activate && \
echo "[[ -f /app/.venv ]] && cd /app && . /app/.venv/bin/activate" >> /home/flowbots/.bashrc && \
echo "gem: --user-instal --no-document" >> /home/flowbots/.gemrc && \
pip3 install -U setuptools wheel && \
pip3 install -U spacy 'pdfminer.six[image]' && \
python3 -m spacy download en_core_web_lg && \
python -c "import sys, importlib.util as util; 1 if util.find_spec('nltk') else sys.exit(); import nltk; nltk.download('punkt')"
RUN if [ "${USE_TRF}" = "True"]; then \
. /app/.venv/bin/activate && \
python3 -m spacy download en_core_web_trf \
; fi
RUN if [ "${USE_BOOKNLP}" = "True"]; then \
. /app/.venv/bin/activate && \
pip3 install -U transformers booknlp \
; fi
# Copy only the Gemfile and requirements.txt
COPY Gemfile ./
# Copy the rest of the application code
# Copy only the specified directories and files
COPY bin/ ./bin/
COPY examples/ ./examples/
COPY exe/ ./exe/
COPY lib/ ./lib/
COPY nano-bots/ ./nano-bots/
COPY flowbots.json .
# Set environment variables
ENV LANG=C.UTF-8 \
LC_ALL=C.UTF-8
# Create necessary directories
RUN mkdir -p log models workspace
RUN chown -R flowbots:flowbots /app
USER flowbots
ENV PATH="/home/flowbots/.local/share/gem/ruby/3.3.0/bin:$PATH"
ENV PATH="/app/.venv/bin:$PATH"
RUN bundle lock --add-platform x86_64-linux && \
bundle config build.redic --with-cxx="clang++" --with-cflags="-std=c++0x" && \
bundle install
# Set the default command (can be overridden)
CMD . .venv/bin/activate && exec bash