Skip to content

Instantly share code, notes, and snippets.

@defektive
Created June 13, 2016 22:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save defektive/554fb038dfd4a95c9e746aaf75422ab3 to your computer and use it in GitHub Desktop.
Save defektive/554fb038dfd4a95c9e746aaf75422ab3 to your computer and use it in GitHub Desktop.
Canvas Dockerfile and docker-compose
COMPOSE_FILE=docker-compose.custom.yml
# ```
# dc up
# dc exec web bash -C "npm install && bundle && bundle exec rake db:create db:initial_setup canvas:compile_assets"
#
version: '2'
services:
postgres:
image: postgres:9.3
volumes:
- pg_data:/var/lib/postgresql/data
redis:
image: redis:2.6
web: &WEB
user: root
build:
context: .
volumes:
- node_modules:/usr/src/app/node_modules
- canvas-gems:/home/docker/.gem/ruby/2.1.0
- ./:/usr/src/app
links:
- postgres
- redis
external_links:
- dory_dinghy_http_proxy:google-drive-lti.dev
environment:
RACK_ENV: development
VIRTUAL_HOST: .canvas.*
jobs:
<<: *WEB
command: bundle exec script/delayed_job run
guard:
<<: *WEB
command: bundle exec guard -i
volumes:
node_modules:
driver: local
canvas-gems:
driver: local
pg_data:
driver: local
FROM instructure/ruby:2.1
USER root
RUN echo 'gem: --no-document' >> /root/.gemrc
RUN curl -sL https://deb.nodesource.com/setup_0.12 | bash -
RUN apt-get update -qq \
&& apt-get install -qqy \
nodejs \
wget \
postgresql-client \
libxmlsec1-dev \
unzip \
fontforge \
&& npm install -g gulp \
&& rm -rf /var/lib/apt/lists/* \
&& curl https://bin.equinox.io/c/ekMN3bCZFUn/forego-stable-linux-amd64.tgz | tar -xzvf - \
&& mv forego /bin && chmod +x /bin/forego
# We will need sfnt2woff in order to build fonts
WORKDIR /root
RUN if [ -e /var/lib/gems/$RUBY_MAJOR.0/gems/bundler-* ]; then BUNDLER_INSTALL="-i /var/lib/gems/$RUBY_MAJOR.0"; fi \
&& curl -O http://people.mozilla.org/~jkew/woff/woff-code-latest.zip \
&& unzip woff-code-latest.zip \
&& make \
&& cp sfnt2woff /usr/local/bin \
&& gem uninstall --all --ignore-dependencies --force $BUNDLER_INSTALL bundler \
&& gem install bundler --no-document -v 1.11.2 \
&& find $GEM_HOME ! -user docker | xargs chown docker:docker
USER docker
WORKDIR /usr/src/app
EXPOSE 5000
CMD ["forego", "start"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment