mirror of
https://github.com/grocy/grocy.git
synced 2026-03-27 23:29:25 +01:00
Set up devcontainer for local dev
Add a complete devcontainer setup to enable one-click development environment setup in VS Code with all dependencies and services pre-configured.
This commit is contained in:
parent
68b4abfac4
commit
ec81176515
49
.devcontainer/Dockerfile
Normal file
49
.devcontainer/Dockerfile
Normal file
|
|
@ -0,0 +1,49 @@
|
||||||
|
FROM php:8.2-apache
|
||||||
|
|
||||||
|
# Install system dependencies
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
git \
|
||||||
|
curl \
|
||||||
|
libpng-dev \
|
||||||
|
libonig-dev \
|
||||||
|
libxml2-dev \
|
||||||
|
libzip-dev \
|
||||||
|
libicu-dev \
|
||||||
|
sqlite3 \
|
||||||
|
libsqlite3-dev \
|
||||||
|
unzip \
|
||||||
|
nodejs \
|
||||||
|
npm \
|
||||||
|
&& apt-get clean \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Install PHP extensions
|
||||||
|
RUN docker-php-ext-configure gd \
|
||||||
|
&& docker-php-ext-install -j$(nproc) \
|
||||||
|
gd \
|
||||||
|
intl \
|
||||||
|
pdo \
|
||||||
|
pdo_sqlite \
|
||||||
|
mbstring \
|
||||||
|
zip \
|
||||||
|
fileinfo
|
||||||
|
|
||||||
|
# Enable Apache modules
|
||||||
|
RUN a2enmod rewrite
|
||||||
|
|
||||||
|
# Install Composer
|
||||||
|
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
||||||
|
|
||||||
|
# Install Yarn
|
||||||
|
RUN npm install -g yarn
|
||||||
|
|
||||||
|
# Set working directory
|
||||||
|
WORKDIR /workspaces/grocy
|
||||||
|
|
||||||
|
# Configure Apache to point to public directory
|
||||||
|
ENV APACHE_DOCUMENT_ROOT=/workspaces/grocy/public
|
||||||
|
RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf
|
||||||
|
RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
|
||||||
|
|
||||||
|
# Set permissions for data directory
|
||||||
|
RUN mkdir -p /workspaces/grocy/data && chmod 777 /workspaces/grocy/data
|
||||||
20
.devcontainer/devcontainer.json
Normal file
20
.devcontainer/devcontainer.json
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
{
|
||||||
|
"name": "Grocy Development",
|
||||||
|
"build": {
|
||||||
|
"dockerfile": "Dockerfile",
|
||||||
|
"context": "."
|
||||||
|
},
|
||||||
|
"forwardPorts": [
|
||||||
|
80
|
||||||
|
],
|
||||||
|
"postCreateCommand": "bash -c 'composer install && yarn install && if [ ! -f data/config.php ]; then cp config-dist.php data/config.php; fi && chmod -R 777 data'",
|
||||||
|
"postStartCommand": "apache2-foreground &",
|
||||||
|
"customizations": {
|
||||||
|
"vscode": {
|
||||||
|
"settings": {
|
||||||
|
"php.validate.executablePath": "/usr/local/bin/php"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"remoteUser": "root"
|
||||||
|
}
|
||||||
7
.vscode/extensions.json
vendored
Normal file
7
.vscode/extensions.json
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"recommendations": [
|
||||||
|
"bmewburn.vscode-intelephense-client",
|
||||||
|
"xdebug.php-debug",
|
||||||
|
"editorconfig.editorconfig"
|
||||||
|
]
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user