diff options
author | Robert Speicher <robert@gitlab.com> | 2018-10-31 17:13:50 +0000 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2018-10-31 17:13:50 +0000 |
commit | dd807d46ff701be1df0989f9f5c8f5f74badfa9c (patch) | |
tree | 2011b52e4900cc9bb7630461295531213cb0d079 /scripts | |
parent | 3c01ac9f7ef460e4d4e9b590ad7531386012d7ba (diff) | |
parent | 70ee4e1b3ea9b5fa59fbe3e60733c5601804fc9e (diff) | |
download | gitlab-ce-dd807d46ff701be1df0989f9f5c8f5f74badfa9c.tar.gz |
Merge branch 'add-docker-assets-image' into 'master'
Build an assets only container
See merge request gitlab-org/gitlab-ce!22235
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/build_assets_image | 21 |
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} + |