forked from concerto/concerto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.alt
85 lines (69 loc) · 3.46 KB
/
Dockerfile.alt
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
FROM ubuntu:16.04
RUN apt-get update
RUN apt-get install locales
# Set the locale
RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
# Install dependencies
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update
RUN apt-get install -qq wget unzip build-essential cmake gcc libcunit1-dev libudev-dev apt-transport-https
# because phusion says to...
ENV HOME /root
CMD ["/sbin/my_init"]
# we need libreoffice to convert documents to pdfs, imagemagick for graphics handling, nmap to tell us if the db is up
WORKDIR /tmp
RUN add-apt-repository ppa:libreoffice/ppa
RUN apt-get update
RUN install_clean libreoffice ghostscript libgs-dev imagemagick ruby-rmagick libmagickcore-dev libmagickwand-dev nmap gsfonts poppler-utils
RUN wget -O - http://dl.concerto-signage.org/concerto_deb_public.key | sudo apt-key add -
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 561F9B9CAC40B2F7
RUN 'deb http://dl.concerto-signage.org/packages/ stretch main\ndeb https://oss-binaries.phusionpassenger.com/apt/passenger stretch main' > /tmp/concerto.list
RUN cp -fr /tmp/concerto.list /etc/apt/sources.list.d/
RUN rm /tmp/concerto.list
RUN apt-get update
# set up for eastern timezone by default
RUN ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime
RUN DEBIAN_FRONTEND=noninteractive install_clean tzdata
# enable nginx and configure the site
RUN rm -f /etc/service/nginx/down
RUN rm /etc/nginx/sites-enabled/default
COPY tools/nginx.docker.conf /etc/nginx/sites-enabled/concerto.conf
# set up the concerto application
RUN mkdir -p /home/app/concerto/log
RUN mkdir -p /home/app/concerto/tmp
WORKDIR /home/app/concerto
COPY . /home/app/concerto
COPY config/database.yml.docker /home/app/concerto/config/database.yml
RUN chown -R app:app /home/app/concerto
RUN setuser app bash --login -c "cd /home/app/concerto && gem install bundler -v '1.17.3' && RAILS_ENV=production bundle install --path=vendor/bundle"
# set up the background worker
RUN mkdir -p /etc/service/concerto_clockwork
COPY tools/service.clockwork.docker.sh /etc/service/concerto_clockwork/run
RUN chmod +x /etc/service/concerto_clockwork/run
RUN mkdir -p /etc/service/concerto_worker
COPY tools/service.worker.docker.sh /etc/service/concerto_worker/run
RUN chmod +x /etc/service/concerto_worker/run
# set up migration, and assets to precompile on each startup, but waits for db to be reachable first
RUN mkdir -p /etc/my_init.d
COPY tools/startup.docker.sh /etc/my_init.d/99_startup_concerto.sh
RUN chmod +x /etc/my_init.d/99_startup_concerto.sh
# set up log rotation
COPY tools/logrotate.app.docker /etc/logrotate.d/concerto
RUN chmod 0644 /etc/logrotate.d/concerto
# fix Imagemagick policy for converting files
# https://stackoverflow.com/a/52661288/1778068
RUN cat /etc/ImageMagick-6/policy.xml | sed 's/domain="coder" rights="none" pattern="PDF"/domain="coder" rights="read|write" pattern="PDF"/' >/etc/ImageMagick-6/policy.xml
WORKDIR /tmp
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# TODO! we still need to figure out how to handle updates and accommodate changes from optional plugins
# db for schema.rb changes on migrations from plugins
# doc for custom help
# log for logs
# tmp for locks and assets?
# public for assets
# vendor for plugin gems
# what about Gemfile.lock and Gemfile-plugins and Gemfile-plugins.bak?
VOLUME ["/home/app/concerto/db", "/home/app/concerto/doc", "/home/app/concerto/log", "/home/app/concerto/tmp", "/home/app/concerto/public", "/home/app/concerto/vendor"]