-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
132 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
APP_NAME=Laracord | ||
APP_ENV=development | ||
|
||
DISCORD_TOKEN= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
docker-compose.override.yml | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
FROM ghcr.io/laracord/egg:php8 | ||
|
||
USER root | ||
|
||
RUN apk update \ | ||
&& apk add --no-cache --repository https://dl-cdn.alpinelinux.org/alpine/edge/testing watchexec ripgrep | ||
|
||
USER vscode | ||
ENV USER vscode | ||
ENV HOME /home/vscode | ||
|
||
WORKDIR /app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
{ | ||
"name": "Bot", | ||
"build": { | ||
"dockerfile": "Dockerfile", | ||
"context": "..", | ||
"options": [ | ||
"--add-host=host.docker.internal:host-gateway" | ||
] | ||
}, | ||
"runArgs": [ | ||
"--privileged" | ||
], | ||
"features": { | ||
"ghcr.io/devcontainers/features/common-utils:2": { | ||
"installZsh": "true", | ||
"username": "vscode", | ||
"userUid": "1000", | ||
"userGid": "1000", | ||
"upgradePackages": "true" | ||
} | ||
}, | ||
"mounts": [ | ||
"source=${localEnv:HOME}/.ssh,target=/home/vscode/.ssh,type=,type=bind,readonly" | ||
], | ||
"overrideCommand": true, | ||
"initializeCommand": "[ ! -f '.devcontainer/.env' ] && cp '.devcontainer/config/app/.env.example' '.devcontainer/.env' || true", | ||
"onCreateCommand": "chmod +x /app/framework/.devcontainer/install.sh && /app/framework/.devcontainer/install.sh", | ||
"forwardPorts": [], | ||
"workspaceFolder": "/app", | ||
"workspaceMount": "source=${localWorkspaceFolder},target=/app/framework,type=bind,consistency=cached", | ||
"remoteUser": "vscode", | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"mikestead.dotenv", | ||
"amiralizadeh9480.laravel-extra-intellisense", | ||
"ryannaddy.laravel-artisan", | ||
"onecentlin.laravel5-snippets", | ||
"onecentlin.laravel-blade", | ||
"bmewburn.vscode-intelephense-client" | ||
], | ||
"settings": { | ||
"php.validate.executablePath": "/usr/local/bin/php" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#!/bin/ash | ||
|
||
set -eux | ||
|
||
# Add a welcome message | ||
echo 'π Welcome to Laracord Development π€' | sudo tee /usr/local/etc/vscode-dev-containers/first-run-notice.txt | ||
|
||
# This is the default .env file used by the application | ||
FALLBACK_APP_ENV_FILE="/app/framework/.devcontainer/.env.example"; | ||
APP_ENV_FILE="${FALLBACK_APP_ENV_FILE}"; | ||
|
||
# If .env file exists in the workspace, let's use that instead | ||
if [ ! -z ${APP_ENV+x} ] && [ -f "/app/framework/.devcontainer/.env.${APP_ENV}" ]; then | ||
APP_ENV_FILE="/app/framework/.devcontainer/.env.${APP_ENV}"; | ||
elif [ -f "/app/framework/.devcontainer/.env" ]; then | ||
APP_ENV_FILE="/app/framework/.devcontainer/.env"; | ||
fi | ||
|
||
. "${APP_ENV_FILE}"; | ||
# source our application env vars | ||
|
||
REPOSITORY_URL="${REPOSITORY_URL:-"https://github.com/laracord/laracord.git"}" | ||
|
||
sudo mkdir -p /app/laracord | ||
sudo chown -R vscode:vscode /app/laracord | ||
cd /app/laracord | ||
|
||
# Install composer | ||
curl -s https://getcomposer.org/installer | php | ||
sudo mv composer.phar /usr/local/bin/composer | ||
sudo chmod +x /usr/local/bin/composer | ||
|
||
# if composer.json already exists, exit early | ||
if [ -f "composer.json" ]; then | ||
exit 0 | ||
fi | ||
|
||
# Clone the repository | ||
git clone --depth=1 ${REPOSITORY_URL} . \ | ||
&& rm -rf .git | ||
|
||
# if composer.json does not exist, exit with error message | ||
if [ ! -f "composer.json" ]; then | ||
echo "composer.json not found in /app/laracord" | ||
exit 1 | ||
fi | ||
|
||
# copy .env file if APP_ENV_FILE is default, otherwise link .env file | ||
[ "${APP_ENV_FILE}" = "${FALLBACK_APP_ENV_FILE}" ] \ | ||
&& cp "${APP_ENV_FILE}" /app/laracord/.env \ | ||
|| ln -fs "${APP_ENV_FILE}" /app/laracord/.env | ||
|
||
cd /app/laracord | ||
|
||
# Install Composer dependencies | ||
composer -d /app/laracord install --no-progress --optimize-autoloader --prefer-dist --no-interaction | ||
|
||
# Link the workspace folder | ||
cat /app/laracord/composer.json | jq ".repositories += [{ type: \"path\", url: \"/app/framework\" }]" > /app/laracord/composer.tmp \ | ||
&& rm /app/laracord/composer.json \ | ||
&& mv /app/laracord/composer.tmp /app/laracord/composer.json \ | ||
&& composer require -d /app/laracord $(cat "/app/framework/composer.json" | jq '.name' | tr -d '"') --no-interaction -W | ||
|
||
# Set filesystem permissions | ||
sudo chown -R vscode:vscode /app/laracord | ||
sudo find /app/laracord/ -type d -exec chmod g+s {} \; | ||
sudo chmod g+w -R /app/laracord |