summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorIan Baum <ibaum@gitlab.com>2018-10-09 13:26:43 -0500
committerIan Baum <ibaum@gitlab.com>2018-10-31 11:21:14 -0500
commit70ee4e1b3ea9b5fa59fbe3e60733c5601804fc9e (patch)
tree76dd3dc85be043fcdbf3885ee9842e2d8bda9562 /scripts
parent86d8fd86a719aa493905d7168d6f9da433ad8600 (diff)
downloadgitlab-ce-70ee4e1b3ea9b5fa59fbe3e60733c5601804fc9e.tar.gz
Build a docker container storing only the frontent assets
* Run as part of gitlab:assets:compile job * Will be used by omnibus-gitlab and the CNG images to avoid compiling multiple times https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/22235
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build_assets_image21
1 files changed, 21 insertions, 0 deletions
diff --git a/scripts/build_assets_image b/scripts/build_assets_image
new file mode 100755
index 00000000000..218606b9a40
--- /dev/null
+++ b/scripts/build_assets_image
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+# Generate the image name based on the project this is being run in
+ASSETS_IMAGE_NAME=$(echo ${CI_PROJECT_NAME} |
+ awk '{
+ split($1, p, "-");
+ interim = sprintf("%s-assets-%s", p[1], p[2]);
+ sub(/-$/, "", interim);
+ print interim
+ }'
+)
+
+ASSETS_IMAGE_PATH=${CI_REGISTRY}/${CI_PROJECT_PATH}/${ASSETS_IMAGE_NAME}
+
+mkdir -p assets_container.build/public
+cp -r public/assets assets_container.build/public/
+cp Dockerfile.assets assets_container.build/
+docker build -t ${ASSETS_IMAGE_PATH}:${CI_COMMIT_REF_NAME} -f assets_container.build/Dockerfile.assets assets_container.build/
+docker login -u gitlab-ci-token -p ${CI_JOB_TOKEN} ${CI_REGISTRY}
+docker push ${ASSETS_IMAGE_PATH}
+