-
Notifications
You must be signed in to change notification settings - Fork 10
/
Dockerfile
60 lines (46 loc) · 2.11 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
# Build it like this:
# docker build --tag webportal-service:improve-build .
# Run it like this:
# docker run -p 80:80 -v /absolute/location/of/your/export.zip:/home/specify/webportal-installer/specify_exports/export.zip webportal-service:improve-build
FROM ubuntu:18.04
LABEL maintainer="Specify Collections Consortium <github.com/specify>"
# Get Ubuntu packages
RUN apt-get update && apt-get -y install \
nginx \
unzip \
curl \
wget \
python \
python-lxml \
make \
lsof \
default-jre \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Create a user and group for the application
RUN groupadd -g 999 specify && \
useradd -r -u 999 -g specify specify
# Create the application directory and set ownership
RUN mkdir -p /home/specify/webportal-installer && chown specify:specify -R /home/specify
# Switch to the specify user
USER specify
# Copy the application files into the container
COPY --chown=specify:specify . /home/specify/webportal-installer
WORKDIR /home/specify/webportal-installer
# Expose the port for the web portal
EXPOSE 80
# Switch back to root user for further configuration
USER root
# Configure nginx to proxy the Solr requests and serve the static files
COPY webportal-nginx.conf /etc/nginx/sites-available/webportal-nginx.conf
# Disable the default nginx site and enable the portal site
RUN rm /etc/nginx/sites-enabled/default \
&& ln -s /etc/nginx/sites-available/webportal-nginx.conf /etc/nginx/sites-enabled/ \
&& service nginx stop
# Redirect nginx logs to stdout and stderr
RUN ln -sf /dev/stderr /var/log/nginx/error.log && ln -sf /dev/stdout /var/log/nginx/access.log
# Build the Solr app
# Run Solr in foreground
# Wait for Solr to load
# Import data from the .zip file
# Run Docker in foreground
CMD ["sh", "-c", "make clean-all && make build-all && ./build/bin/solr start -force && sleep 20 && curl -v \"http://localhost:8983/solr/export/update/csv?commit=true&encapsulator=\\\"&escape=\\&header=true\" --data-binary @./build/col/export/PortalFiles/PortalData.csv -H 'Content-type:application/csv' && nginx -g 'daemon off;'"]