100 lines
3.3 KiB
Docker
100 lines
3.3 KiB
Docker
<%= generation_message %>
|
|
ARG RUBY=3.3
|
|
|
|
<% if jenkins? -%>
|
|
FROM starlord.inscloudgate.net/jenkins/ruby-passenger:$RUBY
|
|
<% else -%>
|
|
FROM instructure/ruby-passenger:$RUBY
|
|
<% end -%>
|
|
LABEL maintainer="Instructure"
|
|
|
|
ARG RUBY
|
|
ARG POSTGRES_CLIENT=14
|
|
ENV APP_HOME /usr/src/app/
|
|
<% if development? -%>
|
|
ENV RAILS_ENV development
|
|
<% else -%>
|
|
ENV RAILS_ENV production
|
|
ENV SASS_STYLE compressed
|
|
<% end -%>
|
|
<% if production? -%>
|
|
env RAILS_LOAD_ALL_LOCALES=1
|
|
<% end -%>
|
|
ENV NGINX_MAX_UPLOAD_SIZE 10g
|
|
ENV LANG en_US.UTF-8
|
|
ENV LANGUAGE en_US.UTF-8
|
|
ENV LC_CTYPE en_US.UTF-8
|
|
ENV LC_ALL en_US.UTF-8
|
|
ARG CANVAS_RAILS=7.1
|
|
ENV CANVAS_RAILS=${CANVAS_RAILS}
|
|
|
|
ENV NODE_MAJOR 18
|
|
ENV YARN_VERSION 1.19.1-1
|
|
ENV GEM_HOME /home/docker/.gem/$RUBY
|
|
ENV PATH ${APP_HOME}bin:$GEM_HOME/bin:$PATH
|
|
ENV BUNDLE_APP_CONFIG /home/docker/.bundle
|
|
|
|
WORKDIR $APP_HOME
|
|
|
|
USER root
|
|
<% if development? -%>
|
|
|
|
ARG USER_ID
|
|
# This step allows docker to write files to a host-mounted volume with the correct user permissions.
|
|
# Without it, some linux distributions are unable to write at all to the host mounted volume.
|
|
RUN if [ -n "$USER_ID" ]; then usermod -u "${USER_ID}" docker \
|
|
&& chown --from=9999 docker /usr/src/nginx /usr/src/app -R; fi
|
|
|
|
<% end -%>
|
|
RUN mkdir -p /etc/apt/keyrings \
|
|
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
|
|
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_${NODE_MAJOR}.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list \
|
|
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
|
|
&& echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \
|
|
&& printf 'path-exclude /usr/share/doc/*\npath-exclude /usr/share/man/*' > /etc/dpkg/dpkg.cfg.d/01_nodoc \
|
|
&& echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list \
|
|
&& curl -sS https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \
|
|
&& add-apt-repository ppa:git-core/ppa -ny \
|
|
&& apt-get update -qq \
|
|
&& apt-get install -qqy --no-install-recommends \
|
|
nodejs \
|
|
yarn="$YARN_VERSION" \
|
|
libxmlsec1-dev \
|
|
python3-lxml \
|
|
python-is-python3 \
|
|
libicu-dev \
|
|
libidn11-dev \
|
|
parallel \
|
|
postgresql-client-$POSTGRES_CLIENT \
|
|
unzip \
|
|
pbzip2 \
|
|
<% if development? -%>fontforge <% end -%>\
|
|
git \
|
|
build-essential \
|
|
&& rm -rf /var/lib/apt/lists/* \
|
|
&& mkdir -p /home/docker/.gem/ruby/$RUBY_MAJOR.0
|
|
|
|
RUN gem install bundler --no-document -v 2.5.10 \
|
|
&& find $GEM_HOME ! -user docker | xargs chown docker:docker
|
|
RUN npm install -g npm@9.8.1 && npm cache clean --force
|
|
|
|
USER docker
|
|
|
|
<% if development? -%>
|
|
RUN set -eux; \
|
|
mkdir -p \
|
|
<%= docker_compose_volume_paths.join(" \\\n ") %>
|
|
<% end -%>
|
|
<% if production? -%>
|
|
COPY --chown=docker:docker . /usr/src/app
|
|
RUN mkdir -p tmp/files
|
|
ENV COMPILE_ASSETS_BRAND_CONFIGS=0
|
|
ENV COMPILE_ASSETS_NPM_INSTALL=0
|
|
RUN unset RUBY && bundle config --global build.nokogiri --use-system-libraries && \
|
|
bundle config --global build.ffi --enable-system-libffi && \
|
|
bundle install
|
|
RUN yarn install --frozen-lockfile || yarn install --frozen-lockfile --network-concurrency 1 && \
|
|
bin/rails canvas:compile_assets --trace && \
|
|
rm -rf node_modules
|
|
<% end -%>
|