Moving a legacy rails app (rails 3.2) over to docker. I have it working fine locally with docker-compose. The problem comes when I try to build the container for staging.
The line RUN bin/rake assets:precompile
it fails because it is initializing the app on precompile event though I have it set to not initialize.
Any help would be greatly appreciated.
Docker File
FROM ruby:2.3.8
ARG RAILS_SECRET_KEY
ARG RAILS_ENV=staging
ARG GITHUB_REPO_API_TOKEN
ARG POSTGRES_USER
ARG POSTGRES_PASSWORD
ARG POSTGRES_DB
ARG DATABASE_HOST
ARG FOG_PROVIDER
ARG FOG_REGION
ARG ASSET_FOG_DIRECTORY
ARG AWS_ACCESS_KEY_ID
ARG AWS_SECRET_ACCESS_KEY
# Most of these deps are for running JS tests. You can add whatever extra deps your project has (ffmpeg, imagemagick, etc)
RUN apt-get update
RUN apt-get update -yqq && apt-get install -yqq --no-install-recommends \
nodejs \
qt5-default \
libqt5webkit5-dev \
xvfb \
postgresql \
postgresql-contrib \
imagemagick \
openjdk-8-jdk
# cache the gemfile seperate
COPY Gemfile* /usr/src/app/
# required at CLI
ENV BUNDLE_GITHUB__COM=${GITHUB_REPO_API_TOKEN}:x-oauth-basic
# You'll need something here. For development, you don't need anything super secret.
ENV SECRET_KEY_BASE=${RAILS_SECRET_KEY}
ENV RAILS_ENV=${RAILS_ENV}
# this tells container to cd into app directory
WORKDIR /usr/src/app
# so we don't have to reinstall all the gems when we add just one when we build a new container
ENV BUNDLE_PATH /gems
RUN bundle install
# copy app dir into /usr/src/app in container
COPY . /usr/src/app/
RUN bin/rake assets:precompile
# for the irritating times the server doesn't clean up when container shutsdown
ENTRYPOINT ["./docker-entrypoint.sh"]
CMD ["bin/rails", "s", "-b", "0.0.0.0"]
staging.rb
# Compress JavaScripts and CSS
config.assets.compress = true
config.assets.initialize_on_precompile = false
Aucun commentaire:
Enregistrer un commentaire