Note: The default ITS GitLab runner is a shared resource and is subject to slowdowns during heavy usage.
You can run your own GitLab runner that is dedicated just to your group if you need to avoid processing delays.

Commit 3a68b246 authored by Jon Yu's avatar Jon Yu
Browse files

Add helper script that uses Docker env for generating project

parent 1a6a253d
#!/usr/bin/env bash
set -exE
readonly IMAGE_TAG=umich_django_template
readonly CONTAINER_NAME=$IMAGE_TAG
readonly CONTAINER_PROJECT_DIR=/usr/src/"$2"
clean_up() {
docker stop $CONTAINER_NAME
}
if [ "$#" -ne 2 ]; then
echo "Usage: $1 Project Output Path; $2 Project Name" >&2
exit 1
fi
if ! [ -d "$1" ]; then
echo "$1 not a directory" >&2
exit 1
fi
trap clean_up EXIT
docker build -t $IMAGE_TAG .
docker run --rm -d -t -v "$1":"$CONTAINER_PROJECT_DIR":z --name $CONTAINER_NAME --entrypoint /bin/bash $IMAGE_TAG
docker exec -it $CONTAINER_NAME django-admin startproject --template ./ "$2" "$CONTAINER_PROJECT_DIR"
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment