Spaces:
Runtime error
Runtime error
rhoitjadhav
commited on
Commit
•
0dafcc8
1
Parent(s):
142dd1a
update dockerfile
Browse files- Dockerfile +17 -31
- start.sh +6 -27
Dockerfile
CHANGED
@@ -1,42 +1,28 @@
|
|
1 |
-
FROM
|
2 |
|
3 |
-
#
|
4 |
-
EXPOSE 6900
|
5 |
-
|
6 |
-
# Environment variables
|
7 |
-
ENV ARGILLA_LOCAL_AUTH_USERS_DB_FILE=/packages/users.yml
|
8 |
ENV UVICORN_PORT=6900
|
|
|
|
|
|
|
|
|
9 |
|
10 |
-
|
11 |
-
COPY *.whl /packages/
|
12 |
-
|
13 |
-
# Copy users db file along with execution script
|
14 |
-
COPY start.sh /
|
15 |
-
COPY load_data.py /
|
16 |
-
COPY users.yml /packages/
|
17 |
|
18 |
# Install packages
|
19 |
RUN apt update
|
20 |
-
RUN apt -y install python3.9-dev gcc gnupg apache2-utils
|
|
|
|
|
|
|
21 |
|
22 |
-
# Create new user for starting elasticsearch
|
23 |
-
RUN useradd -ms /bin/bash user -p "$(openssl passwd -1 ubuntu)"
|
24 |
-
RUN echo 'user ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
|
25 |
|
26 |
-
|
27 |
-
RUN chmod +x /start.sh
|
28 |
-
&& for wheel in /packages/*.whl; do pip3 install "$wheel"[server]; done
|
29 |
|
30 |
-
|
31 |
-
RUN curl -fsSL https://artifacts.elastic.co/GPG-KEY-elasticsearch | apt-key add -
|
32 |
-
RUN echo "deb https://artifacts.elastic.co/packages/8.x/apt stable main" | tee -a /etc/apt/sources.list.d/elastic-8.x.list
|
33 |
-
RUN apt update
|
34 |
-
RUN apt -y install elasticsearch=8.5.3
|
35 |
|
36 |
-
#
|
37 |
-
RUN
|
38 |
-
RUN sudo sed -i "s/cluster.initial_master_nodes/#cluster.initial_master_nodes/g" /etc/elasticsearch/elasticsearch.yml
|
39 |
-
RUN sudo sed -i '$ a\cluster.routing.allocation.disk.threshold_enabled: false' /etc/elasticsearch/elasticsearch.yml
|
40 |
|
41 |
-
|
42 |
-
CMD /bin/bash /start.sh
|
|
|
1 |
+
FROM docker.elastic.co/elasticsearch/elasticsearch:8.5.3
|
2 |
|
3 |
+
# Environment variable
|
|
|
|
|
|
|
|
|
4 |
ENV UVICORN_PORT=6900
|
5 |
+
ENV xpack.security.enabled=false
|
6 |
+
ENV cluster.routing.allocation.disk.threshold_enabled=false
|
7 |
+
ENV discovery.type=single-node
|
8 |
+
ENV ES_JAVA_OPTS=-'Xms512m -Xmx512m'
|
9 |
|
10 |
+
USER root
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
# Install packages
|
13 |
RUN apt update
|
14 |
+
RUN apt -y install curl python3.9 python3.9-dev python3.9-distutils gcc gnupg apache2-utils sudo openssl systemctl
|
15 |
+
RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
|
16 |
+
RUN python3.9 get-pip.py
|
17 |
+
RUN pip3 install datasets
|
18 |
|
|
|
|
|
|
|
19 |
|
20 |
+
COPY start.sh /
|
21 |
+
RUN chmod +x /start.sh
|
|
|
22 |
|
23 |
+
COPY dist/*.whl /packages/
|
|
|
|
|
|
|
|
|
24 |
|
25 |
+
# Install argilla
|
26 |
+
RUN for wheel in /packages/*.whl; do pip install "$wheel"[server]; done
|
|
|
|
|
27 |
|
28 |
+
CMD ["/start.sh"]
|
|
start.sh
CHANGED
@@ -2,33 +2,12 @@
|
|
2 |
|
3 |
set -e
|
4 |
|
5 |
-
#
|
6 |
-
|
|
|
7 |
|
8 |
-
|
9 |
-
|
10 |
-
sudo chown -R elasticsearch:elasticsearch /var/run/elasticsearch
|
11 |
-
sudo chown -R user:user /load_data.py
|
12 |
|
13 |
-
# Start
|
14 |
-
sudo systemctl daemon-reload
|
15 |
-
sudo systemctl enable elasticsearch.service
|
16 |
-
sudo systemctl start elasticsearch.service
|
17 |
-
|
18 |
-
# Generate hashed passwords
|
19 |
-
team_password=$(htpasswd -nbB "" "$TEAM_PASSWORD" | cut -d ":" -f 2 | tr -d "\n")
|
20 |
-
argilla_password=$(htpasswd -nbB "" "$ARGILLA_PASSWORD" | cut -d ":" -f 2 | tr -d "\n")
|
21 |
-
|
22 |
-
|
23 |
-
# Update API_KEY and PASSWORD from users.yml
|
24 |
-
sudo sed -i 's,TEAM_API_KEY,'"$TEAM_API_KEY"',g' /packages/users.yml
|
25 |
-
sudo sed -i 's,ARGILLA_API_KEY,'"$ARGILLA_API_KEY"',g' /packages/users.yml
|
26 |
-
sudo sed -i 's,TEAM_PASSWORD,'"$team_password"',g' /packages/users.yml
|
27 |
-
sudo sed -i 's,ARGILLA_PASSWORD,'"$argilla_password"',g' /packages/users.yml
|
28 |
-
|
29 |
-
# Load data
|
30 |
-
pip3 install datasets
|
31 |
-
python3.9 /load_data.py "$API_KEY" &
|
32 |
-
|
33 |
-
# Start argilla
|
34 |
uvicorn argilla:app --host "0.0.0.0"
|
|
|
2 |
|
3 |
set -e
|
4 |
|
5 |
+
# Start Elasticsearch
|
6 |
+
echo "Starting Elasticsearch"
|
7 |
+
elasticsearch &
|
8 |
|
9 |
+
echo "Waiting for elasticsearch to start"
|
10 |
+
sleep 15
|
|
|
|
|
11 |
|
12 |
+
# Start Argilla
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
uvicorn argilla:app --host "0.0.0.0"
|