-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile
78 lines (73 loc) · 4.05 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
71
72
73
74
75
76
77
78
FROM ubuntu:16.04
# https://github.com/instructure/canvas-lms/wiki/Production-Start#dependency-installation # Brightbox provides updated versions of passenger and ruby (http://wiki.brightbox.co.uk/docs:ruby-ng) RUN apt-get install -y software-properties-common python-software-properties
# We need a pretty new node.js
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get -y update && \
apt-get -y install software-properties-common && \
apt-get -y install vim && \
apt-add-repository -y ppa:brightbox/ruby-ng && \
apt-get -y install curl tzdata apt-transport-https ca-certificates && \
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
apt-get -y update && apt-get -y install --allow-downgrades yarn=0.27.5-1 && \
apt-get -y install python && \
(curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -) && \
(echo 'deb https://deb.nodesource.com/node_0.12 xenial main' > /etc/apt/sources.list.d/nodesource.list) && \
(echo 'deb-src https://deb.nodesource.com/node_0.12 xenial main' >> /etc/apt/sources.list.d/nodesource.list) && \
(apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 561F9B9CAC40B2F7) && \
(echo deb https://oss-binaries.phusionpassenger.com/apt/passenger wily main > /etc/apt/sources.list.d/passenger.list) && \
apt-get -y update && \
apt-get -y install ruby2.4 ruby2.4-dev \
zlib1g-dev libxml2-dev libmysqlclient-dev libxslt1-dev \
imagemagick libpq-dev libxmlsec1-dev libcurl4-gnutls-dev \
libxmlsec1 build-essential openjdk-9-jre unzip git-core \
libapache2-mod-passenger apache2 python-lxml libsqlite3-dev \
passenger passenger-dev nodejs npm ruby-multi-json
RUN cd /opt && git clone --depth 1 --branch stable https://github.com/instructure/canvas-lms.git
RUN gem install -v 1.13.7 bundler
RUN cd /opt/canvas-lms && bundle install --path vendor/bundle --without=sqlite
ADD amazon_s3.yml /opt/canvas-lms/config/
ADD database.yml /opt/canvas-lms/config/
ADD delayed_jobs.yml /opt/canvas-lms/config/
ADD domain.yml /opt/canvas-lms/config/
ADD dynamic_settings.yml /opt/canvas-lms/config/
ADD file_store.yml /opt/canvas-lms/config/
ADD outgoing_mail.yml /opt/canvas-lms/config/
ADD security.yml /opt/canvas-lms/config/
ADD external_migration.yml /opt/canvas-lms/config/
ADD saml.yml /opt/canvas-lms/config/
ADD cache_store.yml /opt/canvas-lms/config/
ADD redis.yml /opt/canvas-lms/config/
ADD selenium.yml /opt/canvas-lms/config/
WORKDIR /opt/canvas-lms
RUN adduser --disabled-password --gecos canvas canvasuser
RUN mkdir -p log tmp/pids public/assets app/stylesheets/brandable_css_brands
RUN touch app/stylesheets/_brandable_variables_defaults_autogenerated.scss
RUN touch Gemfile.lock
RUN chown -R canvasuser config/environment.rb log tmp public/assets \
app/stylesheets/_brandable_variables_defaults_autogenerated.scss \
app/stylesheets/brandable_css_brands Gemfile.lock config.ru
RUN npm install n -g
RUN n 6
RUN yarn install
ENV RAILS_ENV=production
RUN ln -s /usr/bin/nodejs /usr/bin/node && \
npm install [email protected] [email protected] && \
npm install --unsafe-perm
# ruby barfs at non-ascii, need to set encoding.
RUN find /opt/canvas-lms/vendor/bundle/ruby \
-name extractor.rb \
-exec sed -i -e 's/File.read(path)/File.read(path, :encoding => "UTF-8")/' {} \; && \
RAILS_ENV=production bundle exec rake canvas:compile_assets
RUN chown -R canvasuser public/dist/brandable_css
# https://github.com/instructure/canvas-lms/wiki/Production-Start#apache-configuration
RUN a2enmod passenger && a2enmod ssl
ADD canvas_apache.conf /etc/apache2/sites-available/canvas.conf
ADD apache2-wrapper.sh /root/apache2
RUN a2dissite 000-default
RUN a2ensite canvas
EXPOSE 80
EXPOSE 443
RUN cd /opt/canvas-lms/vendor && git clone https://github.com/instructure/QTIMigrationTool.git QTIMigrationTool
RUN chmod +x /opt/canvas-lms/vendor/QTIMigrationTool/migrate.py
CMD ["/bin/bash","/root/apache2"]