split webpack-runner into own Dockerfile
refs DE-1379 Change-Id: Ieb01b5039273299ffd3023454d3c9373d31c96ba Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/301622 Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com> Reviewed-by: Bobby Buten <bobby.buten@instructure.com> Build-Review: Bobby Buten <bobby.buten@instructure.com> QA-Review: Aaron Ogata <aogata@instructure.com> Product-Review: Aaron Ogata <aogata@instructure.com>
This commit is contained in:
parent
8de8e5950f
commit
9d191376e4
|
@ -1,18 +1,2 @@
|
|||
FROM local/webpack-builder AS webpack-runner
|
||||
COPY --chown=docker:docker --from=local/cache-helper-collect-webpack-dependencies /tmp/dst ${APP_HOME}
|
||||
COPY --chown=docker:docker --from=local/cache-helper-collect-webpack /tmp/dst ${APP_HOME}
|
||||
|
||||
ARG JS_BUILD_NO_UGLIFY=0
|
||||
ARG RAILS_LOAD_ALL_LOCALES=0
|
||||
ARG CRYSTALBALL_MAP=0
|
||||
RUN COMPILE_ASSETS_API_DOCS=0 \
|
||||
COMPILE_ASSETS_BRAND_CONFIGS=0 \
|
||||
COMPILE_ASSETS_NPM_INSTALL=0 \
|
||||
COMPILE_ASSETS_STYLEGUIDE=0 \
|
||||
JS_BUILD_NO_UGLIFY="$JS_BUILD_NO_UGLIFY" \
|
||||
RAILS_LOAD_ALL_LOCALES="$RAILS_LOAD_ALL_LOCALES" \
|
||||
CRYSTALBALL_MAP="$CRYSTALBALL_MAP" \
|
||||
bundle exec rails canvas:compile_assets
|
||||
|
||||
FROM local/ruby-runner AS webpack-assets
|
||||
COPY --chown=docker:docker --from=webpack-runner /usr/src/app/public ${APP_HOME}/public
|
||||
FROM local/ruby-runner
|
||||
COPY --chown=docker:docker --from=local/webpack-runner /usr/src/app/public ${APP_HOME}/public
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
FROM local/webpack-builder
|
||||
COPY --chown=docker:docker --from=local/cache-helper-collect-webpack-dependencies /tmp/dst ${APP_HOME}
|
||||
COPY --chown=docker:docker --from=local/cache-helper-collect-webpack /tmp/dst ${APP_HOME}
|
||||
|
||||
ARG JS_BUILD_NO_UGLIFY=0
|
||||
ARG RAILS_LOAD_ALL_LOCALES=0
|
||||
ARG CRYSTALBALL_MAP=0
|
||||
RUN COMPILE_ASSETS_API_DOCS=0 \
|
||||
COMPILE_ASSETS_BRAND_CONFIGS=0 \
|
||||
COMPILE_ASSETS_NPM_INSTALL=0 \
|
||||
COMPILE_ASSETS_STYLEGUIDE=0 \
|
||||
JS_BUILD_NO_UGLIFY="$JS_BUILD_NO_UGLIFY" \
|
||||
RAILS_LOAD_ALL_LOCALES="$RAILS_LOAD_ALL_LOCALES" \
|
||||
CRYSTALBALL_MAP="$CRYSTALBALL_MAP" \
|
||||
bundle exec rails canvas:compile_assets
|
|
@ -61,6 +61,7 @@ RUBY_RUNNER_DOCKERFILE_MD5=$(cat Dockerfile.jenkins.ruby-runner | md5sum)
|
|||
YARN_RUNNER_DOCKERFILE_MD5=$(cat Dockerfile.jenkins.yarn-runner | md5sum)
|
||||
WEBPACK_BUILDER_DOCKERFILE_MD5=$(cat Dockerfile.jenkins.webpack-builder | md5sum)
|
||||
WEBPACK_ASSETS_DOCKERFILE_MD5=$(cat Dockerfile.jenkins.webpack-assets | md5sum)
|
||||
WEBPACK_RUNNER_DOCKERFILE_MD5=$(cat Dockerfile.jenkins.webpack-runner | md5sum)
|
||||
|
||||
./build/new-jenkins/docker-with-flakey-network-protection.sh pull starlord.inscloudgate.net/jenkins/ruby-passenger:$RUBY
|
||||
|
||||
|
@ -71,7 +72,7 @@ BASE_RUNNER_BUILD_ARGS=(
|
|||
--build-arg POSTGRES_CLIENT="$POSTGRES_CLIENT"
|
||||
--build-arg RUBY="$RUBY"
|
||||
)
|
||||
WEBPACK_ASSETS_BUILD_ARGS=(
|
||||
WEBPACK_RUNNER_BUILD_ARGS=(
|
||||
--build-arg JS_BUILD_NO_UGLIFY="$JS_BUILD_NO_UGLIFY"
|
||||
--build-arg RAILS_LOAD_ALL_LOCALES="$RAILS_LOAD_ALL_LOCALES"
|
||||
--build-arg CRYSTALBALL_MAP="$CRYSTALBALL_MAP"
|
||||
|
@ -96,13 +97,17 @@ WEBPACK_BUILDER_PARTS=(
|
|||
$WEBPACK_BUILDER_DOCKERFILE_MD5
|
||||
$PACKAGES_CACHE_MD5
|
||||
)
|
||||
WEBPACK_ASSETS_PARTS=(
|
||||
WEBPACK_RUNNER_PARTS=(
|
||||
"${WEBPACK_BUILDER_PARTS[@]}"
|
||||
"${WEBPACK_ASSETS_BUILD_ARGS[@]}"
|
||||
$WEBPACK_ASSETS_DOCKERFILE_MD5
|
||||
"${WEBPACK_RUNNER_BUILD_ARGS[@]}"
|
||||
$WEBPACK_RUNNER_DOCKERFILE_MD5
|
||||
$WEBPACK_ASSETS_MD5
|
||||
$WEBPACK_ASSETS_DEPENDENCIES_MD5
|
||||
)
|
||||
WEBPACK_ASSETS_PARTS=(
|
||||
"${WEBPACK_RUNNER_PARTS[@]}"
|
||||
$WEBPACK_ASSETS_DOCKERFILE_MD5
|
||||
)
|
||||
|
||||
declare -A BASE_RUNNER_TAGS; compute_tags "BASE_RUNNER_TAGS" $BASE_RUNNER_PREFIX ${BASE_RUNNER_PARTS[@]}
|
||||
declare -A RUBY_RUNNER_TAGS; compute_tags "RUBY_RUNNER_TAGS" $RUBY_RUNNER_PREFIX ${RUBY_RUNNER_PARTS[@]}
|
||||
|
@ -190,16 +195,16 @@ if [ -z "${WEBPACK_ASSETS_SELECTED_TAG}" ]; then
|
|||
|
||||
tag_many $WEBPACK_BUILDER_SELECTED_TAG local/webpack-builder ${WEBPACK_BUILDER_TAGS[SAVE_TAG]} ${WEBPACK_BUILDER_TAGS[UNIQUE_TAG]-}
|
||||
|
||||
# Using a multi-stage build is safe for the below image because
|
||||
# there is no expectation that we will need to use docker's
|
||||
# built-in caching.
|
||||
docker build \
|
||||
"${WEBPACK_ASSETS_BUILD_ARGS[@]}" \
|
||||
"${WEBPACK_RUNNER_BUILD_ARGS[@]}" \
|
||||
--tag local/webpack-runner \
|
||||
- < Dockerfile.jenkins.webpack-runner
|
||||
|
||||
docker build \
|
||||
--label "RUBY_RUNNER_SELECTED_TAG=$RUBY_RUNNER_SELECTED_TAG" \
|
||||
--label "WEBPACK_BUILDER_SELECTED_TAG=$WEBPACK_BUILDER_SELECTED_TAG" \
|
||||
--label "YARN_RUNNER_SELECTED_TAG=$YARN_RUNNER_SELECTED_TAG" \
|
||||
--tag "${WEBPACK_ASSETS_TAGS[SAVE_TAG]}" \
|
||||
--target webpack-assets \
|
||||
- < Dockerfile.jenkins.webpack-assets
|
||||
|
||||
WEBPACK_ASSETS_SELECTED_TAG=${WEBPACK_ASSETS_TAGS[SAVE_TAG]}
|
||||
|
|
Loading…
Reference in New Issue