Skip to content
Snippets Groups Projects
Commit 62703db0 authored by jurgenhaas's avatar jurgenhaas
Browse files

#11 New script in the container to start a new project which gets executed...

#11 New script in the container to start a new project which gets executed automatically when working directory is empty
parent 0429de60
No related branches found
No related tags found
No related merge requests found
......@@ -4,13 +4,14 @@ FROM registry.lakedrops.com/docker/gitlab-drupal-ci:php-${PHP_VERSION}
LABEL com.example.vendor="LakeDrops" \
maintainer="juergen.haas@lakedrops.com" \
version="1.2.0" \
version="1.2.1" \
description="Drupal development environment from LakeDrops."
ENV LAKEDROPS_DEV_ENV 1
ENV LAKEDROPS_DEV_DC_OPTIONS " "
ADD config.fish /etc/fish/
ADD start-new-project /usr/local/bin/
RUN echo "Install dorgflow" && \
cd /var/opt && \
......
......@@ -97,7 +97,13 @@ function start {
--restart unless-stopped \
registry.lakedrops.com/docker/l3d:php-${PHP_VERSION}
fi
docker exec -it ${COMPOSE_PROJECT_NAME}_l3d /usr/bin/fish
EXISTING=$(ls -1)
if [[ -n "$EXISTING" ]]; then
docker exec -it ${COMPOSE_PROJECT_NAME}_l3d /usr/bin/fish
else
docker exec -it ${COMPOSE_PROJECT_NAME}_l3d /usr/local/bin/start-new-project
fi
fi
}
......
#!/usr/bin/env bash
EXISTING=$(ls -1)
if [[ -n "$EXISTING" ]]; then
exit
fi
echo "Lets start a new project here ..."
echo ""
echo "Options to start:"
echo " 1 LakeDrops Drupal 8 project template"
echo " 2 Drupal's community project template"
echo " 3 Existing git repository"
echo ""
echo ""
function truncateCurrentDirectory {
if [[ -f ".env" ]]; then
export $(cat .env | xargs) > /dev/null 2>&1
fi
rm .* > /dev/null 2>&1
}
function create {
truncateCurrentDirectory
composer create-project ${PROJECT} . --no-interaction
}
while true; do
read -p "Choose an option: " OPTION
case ${OPTION} in
1 )
PROJECT="lakedrops/d8-project"
create
break
;;
2 )
PROJECT="drupal-composer/drupal-project:8.x-dev"
create
break
;;
3 )
read -p "Repository URL: " REPOSITORY
if [[ -n "${REPOSITORY}" ]]; then
truncateCurrentDirectory
git clone ${REPOSITORY} .
composer update
break
fi
;;
* )
echo "Please try again."
;;
esac
done
/usr/bin/fish
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment