Skip to content

Commit

Permalink
ci: add devcontainer config
Browse files Browse the repository at this point in the history
  • Loading branch information
keenthekeen committed Sep 25, 2024
1 parent 65f0272 commit 88d6364
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 2 deletions.
28 changes: 28 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM serversideup/php:8.3-unit AS base

# Install additional php extensions (requires root)
USER root
RUN install-php-extensions gd intl redis

# Install Node.js
RUN apt-get update && apt-get install -y nodejs npm
RUN npm install -g pnpm

# Copy the project files
COPY . ${APP_BASE_DIR}
WORKDIR ${APP_BASE_DIR}
RUN mkdir bootstrap/cache
RUN chown -R www-data /var/www/html/

USER www-data

# Install PHP & JS dependencies
RUN composer install --no-dev --no-interaction --no-progress --optimize-autoloader
RUN pnpm install --frozen-lockfile
RUN pnpm build

RUN touch database/database.sqlite
RUN cp -n .env.example .env
RUN php artisan key:generate
RUN php artisan migrate
CMD ["unitd", "--no-daemon"]
28 changes: 28 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// https://aka.ms/devcontainer.json
{
"name": "Laravel dev",
build: {
context: "..",
dockerfile: "Dockerfile"
},
"workspaceFolder": "/var/www/html",
"customizations": {
"vscode": {
"extensions": [
"mikestead.dotenv",
"amiralizadeh9480.laravel-extra-intellisense",
"ryannaddy.laravel-artisan",
// "onecentlin.laravel5-snippets",
// "onecentlin.laravel-blade"
],
"settings": {}
}
},
"remoteUser": "www-data",
"postCreateCommand": "chown -R 1000:1000 /var/www/html 2>/dev/null || true",
"forwardPorts": [
8080
],
// "runServices": [],
// "shutdownAction": "none",
}
4 changes: 2 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ APP_URL=http://localhost
LOG_CHANNEL=stack
LOG_LEVEL=debug

DB_CONNECTION=mysql
DB_CONNECTION=sqlite
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=smcu_pab
#DB_DATABASE=smcu_pab
DB_USERNAME=root
DB_PASSWORD=

Expand Down

0 comments on commit 88d6364

Please sign in to comment.