forked from seek4science/seek
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
70 lines (50 loc) · 1.82 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
FROM ruby:2.4
MAINTAINER Stuart Owen <orcid.org/0000-0003-2130-0865>, Finn Bacall
ENV APP_DIR /seek
ENV RAILS_ENV=production
# need to set the locale, otherwise some gems file to install
ENV LANG="en_US.UTF-8" LANGUAGE="en_US:UTF-8" LC_ALL="C.UTF-8"
RUN apt-get update -qq && \
apt-get install -y --no-install-recommends build-essential git \
libcurl4-gnutls-dev libmagick++-dev libpq-dev libreadline-dev \
libreoffice libsqlite3-dev libssl-dev libxml++2.6-dev \
libxslt1-dev locales mysql-client nginx nodejs openjdk-8-jdk \
poppler-utils postgresql-client sqlite3 links telnet vim-tiny && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
locale-gen en_US.UTF-8
RUN mkdir -p $APP_DIR
RUN chown www-data $APP_DIR
USER www-data
WORKDIR $APP_DIR
# Bundle install throw errors if Gemfile has been modified since Gemfile.lock
COPY Gemfile* ./
RUN bundle config --local frozen 1 && \
bundle install --deployment --without development test
# App code
COPY . .
RUN mkdir log tmp
COPY docker/virtuoso_settings.docker.yml config/virtuoso_settings.yml
USER root
RUN chown -R www-data solr config docker public /var/www db/schema.rb
USER www-data
RUN touch config/using-docker #allows us to see within SEEK we are running in a container
# SQLite Database (for asset compilation)
RUN mkdir sqlite3-db && \
cp docker/database.docker.sqlite3.yml config/database.yml && \
chmod +x docker/upgrade.sh docker/start_workers.sh && \
bundle exec rake db:setup
RUN bundle exec rake assets:precompile && \
rm -rf tmp/cache/*
#root access needed for next couple of steps
USER root
# NGINX config
COPY docker/nginx.conf /etc/nginx/nginx.conf
# Cleanup
RUN rm -rf /tmp/* /var/tmp/*
USER www-data
# Network
EXPOSE 3000
# Shared
VOLUME ["/seek/filestore", "/seek/sqlite3-db", "/seek/tmp/cache"]
CMD ["docker/entrypoint.sh"]