Fix the asset precompile in the Container (#10415)

* Remove yarn steps since we build nod_modules in the asset:precompile step.
* Precompile in production mode.
This commit is contained in:
Joe Doss 2020-09-22 09:08:46 -05:00 committed by GitHub
parent afa5f56faf
commit afd89f7211
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -12,7 +12,7 @@ RUN curl -sL https://dl.yarnpkg.com/rpm/yarn.repo -o /etc/yum.repos.d/yarn.repo
ENV APP_USER=forem
ENV APP_UID=1000
ENV APP_GID=1000
ENV APP_HOME=/opt/apps/forem/
ENV APP_HOME=/opt/apps/forem
ENV LD_PRELOAD=/usr/lib64/libjemalloc.so.2
RUN mkdir -p ${APP_HOME} && chown "${APP_UID}":"${APP_GID}" "${APP_HOME}"
RUN groupadd -g "${APP_GID}" "${APP_USER}" && \
@ -20,7 +20,7 @@ RUN groupadd -g "${APP_GID}" "${APP_USER}" && \
ENV BUNDLER_VERSION=2.1.4
RUN gem install bundler:"${BUNDLER_VERSION}"
ENV GEM_HOME=/opt/apps/bundle/
ENV GEM_HOME=/opt/apps/bundle
ENV BUNDLE_SILENCE_ROOT_WARNING=1 BUNDLE_APP_CONFIG="${GEM_HOME}"
ENV PATH "${GEM_HOME}"/bin:$PATH
RUN mkdir -p "${GEM_HOME}" && chown "${APP_UID}":"${APP_GID}" "${GEM_HOME}"
@ -36,8 +36,8 @@ WORKDIR "${APP_HOME}"
# https://github.com/containers/podman-compose/issues/166
# USER "${APP_USER}"
COPY ./.ruby-version "${APP_HOME}"
COPY ./Gemfile ./Gemfile.lock "${APP_HOME}"
COPY ./.ruby-version "${APP_HOME}"/
COPY ./Gemfile ./Gemfile.lock "${APP_HOME}"/
COPY ./vendor/cache "${APP_HOME}"/vendor/cache
# Fixes https://github.com/sass/sassc-ruby/issues/146
@ -45,15 +45,11 @@ RUN bundle config build.sassc --disable-march-tune-native
RUN bundle check || bundle install --jobs 20 --retry 5
COPY ./package.json ./yarn.lock ./.yarnrc "${APP_HOME}"
COPY ./.yarn "${APP_HOME}"/.yarn
RUN yarn install
RUN mkdir -p "${APP_HOME}"/public/{assets,images,packs,podcasts,uploads}
COPY . "${APP_HOME}"
COPY . "${APP_HOME}"/
RUN bundle exec rake assets:precompile
RUN RAILS_ENV=production NODE_ENV=production bundle exec rake assets:precompile
RUN echo $(date -u +'%Y-%m-%dT%H:%M:%SZ') >> "${APP_HOME}"/FOREM_BUILD_DATE && \
echo $(git rev-parse --short HEAD) >> "${APP_HOME}"/FOREM_BUILD_SHA && \