-
-
Notifications
You must be signed in to change notification settings - Fork 519
/
.gitpod.yml
133 lines (103 loc) · 3.95 KB
/
.gitpod.yml
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# The Docker image to run the workspace in (defaults to gitpod/workspace-full)
image:
file: Dockerfile
workspaceLocation: canvas/gitpod.code-workspace
checkoutLocation: canvas
vscode:
extensions:
- octref.vetur
- esbenp.prettier-vscode
- equinusocio.vsc-material-theme
- equinusocio.vsc-community-material-theme
- equinusocio.vsc-material-theme-icons
- eamodio.gitlens
- github.vscode-pull-request-github
github:
prebuilds:
# Enable for the master/default branch (defaults to true)
master: true
# Enable for all branches in this repo (defaults to false)
branches: true
# Enable for pull requests coming from this repo (defaults to true)
pullRequests: true
# Enable for pull requests coming from forks (defaults to false)
pullRequestsFromForks: true
# Add a check to pull requests (defaults to true)
addCheck: true
# Add a "Review in Gitpod" button as a comment to pull requests (defaults to false)
addComment: true
# Add a "Review in Gitpod" button to the pull request's description (defaults to false)
addBadge: true
# Add a label once the prebuild is ready to pull requests (defaults to false)
addLabel: true
# Command to start on workspace startup (optional)
tasks:
- init: |
# Reload the .bash_profile to utilize the composer-link() function
source ~/.bash_profile
# Remove any existing Composer installation
sudo rm /usr/bin/composer
# Install Composer v2.0
EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')"
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]
then
>&2 echo 'ERROR: Invalid installer checksum'
rm composer-setup.php
exit 1
fi
php composer-setup.php --quiet
RESULT=$?
rm composer-setup.php
# Make Composer globally accessible
sudo mv composer.phar /usr/bin/composer
cd /workspace
# Install a fresh Laravel app
composer create-project --prefer-dist laravel/laravel laravel
cd /workspace/laravel
# Create a new in-memory database
touch database/database.sqlite
# Write the database configuration to the .env file
sed -i 's/DB_CONNECTION=mysql/DB_CONNECTION=sqlite/g' .env && sed -i 's/DB_DATABASE=laravel/#DB_DATABASE=laravel/g' .env
# Link Canvas to the Laravel app
composer-link ../canvas/
composer require austintoddj/canvas @dev
# Install Canvas and its resources
php artisan canvas:install
php artisan storage:link
# Remove any existing assets from the Laravel app
rm -rf public/vendor/canvas/*
# Create a symlink to the local package assets
cd public/vendor/canvas
ln -s ../../../../canvas/public/* .
command: |
cd /workspace/laravel
# Write the local app URL to the .env file
export url=$(gp url 8000); sed -Ei "s|APP_URL=http://localhost|APP_URL=${url}|g" .env
# Write the local asset URL to the .env file
export url=$(gp url 8000); sed -Ei "1i\ASSET_URL=${url}" .env
# Trust any proxy in a chain of proxies
export url=$(gp url 8000); sed -Ei "s|APP_URL=http://localhost|APP_URL=${url}|g" .env
sed -Ei "s|\\\$proxies|\\\$proxies = '*'|g" app/Http/Middleware/TrustProxies.php
# Clear and cache the app configuration
php artisan config:clear
php artisan cache:clear
php artisan config:cache
# Serve the Laravel app
php artisan serve
- init: |
# Initializing the Canvas package
# Install core PHP dependencies
composer install
# Install core JS dependencies
yarn
command: |
yarn watch
openMode: split-right
# Ports to expose on workspace startup (optional)
ports:
- port: 3306
onOpen: ignore
- port: 8000
onOpen: notify