Skip to content

Commit

Permalink
#21. Initial docker version.
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolay-r committed Apr 15, 2022
1 parent 7dd7fc4 commit cd1fa85
Show file tree
Hide file tree
Showing 20 changed files with 1,022 additions and 12 deletions.
2 changes: 2 additions & 0 deletions arelight/pipelines/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,5 @@ def apply_core(self, input_data, pipeline_ctx):
# Save results.
with open(template_fp, "w") as output:
output.write(template)

return template
53 changes: 53 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
FROM ubuntu:18.04

# Requirements for python installation, resource downloading tools, etc.
RUN apt-get update && apt-get install -y git curl wget zlib1g-dev libssl-dev \
build-essential libsqlite3-dev \
libicu-dev locales libbz2-dev

# Python 3.6
RUN curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash
ENV PYENV_ROOT /root/.pyenv
ENV PATH /root/.pyenv/shims:/root/.pyenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
RUN pyenv install 3.6.0
RUN pyenv global 3.6.0

# Locales.
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
dpkg-reconfigure --frontend=noninteractive locales

# Update pip.
RUN pip install --upgrade pip

# Inistall ARElight project.
COPY arelight /arelight
RUN ls -la
RUN pip install /arelight/. -r /arelight/dependencies.txt

# Download required resources.
# RUN python /arelight/download.py

EXPOSE 80

# Setup apache configs.
RUN apt-get clean && apt-get update && apt-get install -y apache2 python
RUN a2enmod cgi
RUN echo export PATH=/root/.pyenv/shims:/root/.pyenv/bin:$PATH >> /etc/apache2/envvars

COPY apache_configs/* /etc/apache2/sites-enabled/

# Copy apache-based arelight demo.
COPY demo /var/www/demo
RUN chmod +x /var/www/demo/wui.py

# Copy BRAT toolkit.
COPY brat /var/www/demo/brat

RUN chmod 777 -R /root/.pyenv && chmod 777 /root

# Setup entrypoint
COPY entrypoint.sh /entrypoint.sh

RUN chmod +x entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
CMD ["apache2ctl", "-D", "FOREGROUND"]
11 changes: 11 additions & 0 deletions docker/apache_configs/brat.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Alias /brat "/var/www/brat"
<Directory "/var/www/brat">
AllowOverride All
Order allow,deny
Allow from all
DirectoryIndex index.html
Options -Indexes +ExecCGI -MultiViews +SymLinksIfOwnerMatch
<Files *.cgi>
SetHandler cgi-script
</Files>
</Directory>
10 changes: 10 additions & 0 deletions docker/apache_configs/demo.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Alias /examples/demo /var/www/demo
<Directory /var/www/demo>
Options Indexes FollowSymLinks ExecCGI
AllowOverride None
Require all granted
<Files wui.py>
SetHandler cgi-script
Options +ExecCGI
</Files>
</Directory>
16 changes: 16 additions & 0 deletions docker/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

script_dir=$(dirname $0)
mkdir --parents $script_dir/arelight
rsync -r $script_dir/../setup.py $script_dir/arelight
rsync -r $script_dir/../dependencies.txt $script_dir/arelight/
rsync -r $script_dir/../download.py $script_dir/arelight
rsync -r $script_dir/../arelight/ $script_dir/arelight/
rsync -r $script_dir/../examples/ $script_dir/examples/

# Download brat
curl https://codeload.github.com/nlplab/brat/zip/refs/heads/v1.3p1 --output brat.zip
unzip brat.zip && mv brat-1.3p1 brat
rm brat.zip

docker build -t nicolay-r/arelight $script_dir
Loading

0 comments on commit cd1fa85

Please sign in to comment.