Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(slb-262): devcontainer init #347

Draft
wants to merge 8 commits into
base: release
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
FROM php:8.2-apache

# Install system dependencies
RUN apt-get update && apt-get install -y \
git \
curl \
libpng-dev \
libonig-dev \
libxml2-dev \
zip \
unzip \
zsh

# Clear cache
RUN apt-get clean && rm -rf /var/lib/apt/lists/*

# Install PHP extensions
RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd

# Install Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer

# Install Node.js 18
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
RUN apt-get install -y nodejs
RUN node --version

# Install pnpm 8.6+
RUN npm install -g pnpm@8.6.12
RUN pnpm --version

# Install SQLite
RUN apt-get update && apt-get install -y sqlite3 libsqlite3-dev

# Install additional PHP extensions for Drupal
RUN docker-php-ext-install opcache
RUN pecl install apcu && docker-php-ext-enable apcu

# Install and enable Xdebug
RUN pecl install xdebug && docker-php-ext-enable xdebug

# Configure Xdebug for remote debugging
RUN echo "xdebug.mode=debug" >> /usr/local/etc/php/conf.d/xdebug.ini && \
echo "xdebug.start_with_request=yes" >> /usr/local/etc/php/conf.d/xdebug.ini && \
echo "xdebug.client_host=host.docker.internal" >> /usr/local/etc/php/conf.d/xdebug.ini && \
echo "xdebug.client_port=9003" >> /usr/local/etc/php/conf.d/xdebug.ini && \
echo "xdebug.log=/tmp/xdebug.log" >> /usr/local/etc/php/conf.d/xdebug.ini

# Install Oh My Zsh
RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended && \
# Set Zsh as the default shell
chsh -s /bin/zsh && \
# Change ownership of the .oh-my-zsh directory
chmod -R 755 /root/.oh-my-zsh

# Set up a basic .zshrc configuration
RUN cp /root/.oh-my-zsh/templates/zshrc.zsh-template /root/.zshrc && \
sed -i 's/ZSH_THEME="robbyrussell"/ZSH_THEME="agnoster"/g' /root/.zshrc

# RUN nvm use 18
# RUN npm i -g pnpm@8.6.12

WORKDIR /workspaces/silverback-template/apps/cms
RUN apt-get update && apt-get install -y git qpdf imagemagick libicu-dev && \
docker-php-ext-install intl && \
docker-php-ext-enable intl
RUN composer config --global github-protocols https

# Change document root for Apache
RUN sed -ri -e 's!/var/www/html!/var/www/html/web!g' /etc/apache2/sites-available/*.conf
RUN sed -ri -e 's!/var/www/!/var/www/html/web!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf

# Install Helix editor
# RUN apt-get update && apt-get install -y software-properties-common && \
# add-apt-repository ppa:maveonair/helix-editor && \
# apt-get update && \
# apt-get install -y helix

# Install phpactor
RUN curl -Lo phpactor.phar https://github.com/phpactor/phpactor/releases/latest/download/phpactor.phar && \
chmod a+x phpactor.phar && \
mv phpactor.phar /usr/local/bin/phpactor

# Install GitHub CLI
RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& apt update \
&& apt install gh -y

ENV NETLIFY_URL=http://localhost:8000
ENV DRUPAL_EXTERNAL_URL=http://localhost:8888
ENV DRUPAL_INTERNAL_URL=http://127.0.0.1:8888
ENV PUBLISHER_URL=http://localhost:8000

# Enable Apache modules
RUN a2enmod rewrite
34 changes: 34 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "PHP 8.2 + SQLite 3 + Node 18 + pnpm 8.6+",
"dockerFile": "Dockerfile",
"forwardPorts": [8080],
"workspaceFolder": "/workspaces/silverback-template",
"postCreateCommand": {
"init": "cd /workspaces/silverback-template && pnpm i && cd /workspaces/silverback-template/tests/e2e && pnpm exec playwright install-deps && cd /workspaces/silverback-template && pnpm turbo:prep"
},
"customizations": {
"vscode": {
"extensions": [
"felixfbecker.php-debug",
"bmewburn.vscode-intelephense-client",
"esbenp.prettier-vscode",
"ZixuanChen.vitest-explorer",
"GraphQL.vscode-graphql",
"GraphQL.vscode-graphql-syntax",
"eamodio.gitlens",
"GitHub.vscode-pull-request-github",
"GitHub.copilot",
"dbaeumer.vscode-eslint",
"ms-azuretools.vscode-docker",
"ms-playwright.playwright",
"denoland.vscode-deno",
"bradlc.vscode-tailwindcss",
"felixfbecker.php-debug",
"humao.rest-client",
"DEVSENSE.phptools-vscode",
"GitHub.vscode-github-actions",
"Graphite.gti-vscode"
]
}
}
}
5 changes: 5 additions & 0 deletions .devcontainer/xedbug.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
zend_extension=xdebug.so
xdebug.mode = debug
xdebug.client_host = 127.0.0.1
xdebug.client_port = 9003
xdebug.start_with_request = trigger
121 changes: 121 additions & 0 deletions apps/website/deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading