-
Notifications
You must be signed in to change notification settings - Fork 0
/
postCreateCommand.sh
executable file
·69 lines (52 loc) · 1.96 KB
/
postCreateCommand.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/bash
set -ex
# This file is called in three scenarios:
# 1. fresh creation of devcontainer
# 2. rebuild
# 3. full rebuild
# ddev default commands
# see: https://ddev.readthedocs.io/en/latest/users/install/ddev-installation/#github-codespaces
# retry, see https://github.com/ddev/ddev/pull/5592
wait_for_docker() {
while true; do
docker ps > /dev/null 2>&1 && break
sleep 1
done
echo "Docker is ready."
}
wait_for_docker
# TODO: remove, might not be needed (auto-detected)
# https://github.com/ddev/ddev/pull/5290#issuecomment-1689024764
ddev config global --omit-containers=ddev-router
# download images beforehand
ddev debug download-images
# avoid errors on rebuilds
ddev poweroff
# Workaround for Vite:
# Normally expose port 5173 for Vite in .ddev/config.yaml, but ddev-router
# is not used on Gitpod / Codespaces, etc. The Routing is handled by Gitpod /
# Codespaces itself. Therefore we will create an additional config file for
# DDEV which will expose port 5173 without ddev-router.
cp .devcontainer/templates/docker-compose.vite-workaround.yaml .ddev/.
# Start the DDEV project
# (will automatically get URL from env, adds db connection to .env)
export DDEV_NONINTERACTIVE=true
ddev start -y
# normal project setup
ddev composer install
ddev npm install
# you could also perform a `ddev pull` here to get an existing remote database
# the following is just an example:
# install craft via CLI
ddev craft install/craft \
--interactive=0 \
--username=admin \
--password=newPassword \
--email=admin@example.com \
--site-name=Testsite
# You could also remove it here and run this in terminal, it will just prompt for your password:
# ddev craft install/craft --username=admin --email=admin@example.com --site-name=Testsite
# If craft was also installed (e.g. when you do a rebuild/full rebuild), this command
# will just state "craft already installed".
# install the vite plugin by nystudio107 after fresh install
ddev craft plugin/install vite