* Add gnupg2 to be able to sign commits * Make sure /var/www/html always belongs to www-data * Add Git-History plugin * Introduce dedicated entrypoint script * Store Postgres database data in volume to be persistent * Cleaner check if NC is already installed in setup.sh * Add composer to DevContainer Signed-off-by: GitHub <noreply@github.com>tags/v27.0.0beta1
@@ -4,7 +4,7 @@ ARG DEBIAN_FRONTEND=noninteractive | |||
# PHP | |||
RUN apt-get update -y && \ | |||
apt install -y apache2 vim software-properties-common sudo nano | |||
apt install -y apache2 vim software-properties-common sudo nano gnupg2 | |||
RUN apt-get install --no-install-recommends -y \ | |||
php8.1 \ | |||
@@ -36,6 +36,15 @@ RUN apt-get install --no-install-recommends -y \ | |||
nodejs \ | |||
npm | |||
# Composer | |||
# Download the Composer installer script to a temporary file | |||
RUN curl -sS https://getcomposer.org/installer -o /tmp/composer-setup.php && \ | |||
curl -sS https://composer.github.io/installer.sig -o /tmp/composer-setup.sig && \ | |||
php -r "if (hash_file('sha384', '/tmp/composer-setup.php') !== trim(file_get_contents('/tmp/composer-setup.sig'))) { echo 'Composer installation failed, invalid hash'; exit(1); }" && \ | |||
php /tmp/composer-setup.php --install-dir=/usr/local/bin --filename=composer && \ | |||
rm /tmp/composer-setup.php /tmp/composer-setup.sig | |||
RUN echo "xdebug.remote_enable = 1" >> /etc/php/8.1/cli/conf.d/20-xdebug.ini && \ | |||
echo "xdebug.remote_autostart = 1" >> /etc/php/8.1/cli/conf.d/20-xdebug.ini | |||
@@ -52,7 +61,7 @@ RUN apt-get -y install \ | |||
curl \ | |||
gnupg-agent \ | |||
software-properties-common && \ | |||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - && \ | |||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - && \ | |||
add-apt-repository \ | |||
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \ | |||
$(lsb_release -cs) \ |
@@ -0,0 +1,35 @@ | |||
# Nextcloud DevContainer | |||
## Usage | |||
Make sure you have the [VSCode DevContainer](https://code.visualstudio.com/docs/devcontainers/containers) extensions installed. If you open the project, VSCode will ask you if you want to open it inside of the DevContainer. If that's not the case, use <kbd>F1</kbd>→*Dev Containers: Open Folder in Container*. | |||
Alternatively open the project directly in [GitHub Codespaces](https://github.com/features/codespaces). | |||
That's already it. Everything else will be configured automatically by the Containers startup routine. | |||
## Credentials | |||
On first start the Container installs and configures Nextcloud with the following credentials: | |||
**Nextcloud Admin Login** | |||
Username: `admin` <br> | |||
Password: `admin` | |||
**Postgres credentials** | |||
Username: `postgres` <br> | |||
Password: `postgres` <br> | |||
Database: `postgres` | |||
## Services | |||
The following services will be started: | |||
| Service | Local port | Description | | |||
|---------|------------|-------------| | |||
| Nextcloud (served via Apache) | `80` | The main application | | |||
| Mailhog | `8025` | SMTP email delivery for testing | | |||
| Adminer | `8080` | Database viewer. Use credentials from above and connect to `localhost:5432` to get access to the NC database | | |||
@@ -3,6 +3,7 @@ | |||
"dockerComposeFile": "docker-compose.yml", | |||
"service": "nextclouddev", | |||
"postCreateCommand": ".devcontainer/setup.sh", | |||
"postStartCommand": "chown -R www-data:www-data /var/www/html", | |||
"forwardPorts": [ | |||
80, | |||
8080, | |||
@@ -14,7 +15,8 @@ | |||
"felixfbecker.php-debug", | |||
"felixfbecker.php-intellisense", | |||
"ms-azuretools.vscode-docker", | |||
"xdebug.php-debug" | |||
"xdebug.php-debug", | |||
"donjayamanne.githistory" | |||
], | |||
"settings": { | |||
"php.suggest.basic": false |
@@ -6,7 +6,7 @@ services: | |||
- .:/workspace:cached | |||
- /var/run/docker.sock:/var/run/docker-host.sock | |||
- ..:/var/www/html | |||
command: /bin/sh -c "chown -R www-data:www-data /var/www/html && service apache2 start && while sleep 1000; do :; done" | |||
command: /var/www/html/.devcontainer/entrypoint.sh | |||
ports: | |||
- 80:80 | |||
- 8080:8080 | |||
@@ -17,6 +17,9 @@ services: | |||
restart: always | |||
environment: | |||
POSTGRES_PASSWORD: postgres | |||
PGDATA: /data/postgres | |||
volumes: | |||
- db:/data/postgres | |||
network_mode: service:nextclouddev | |||
adminer: | |||
@@ -28,3 +31,6 @@ services: | |||
image: mailhog/mailhog | |||
restart: always | |||
network_mode: service:nextclouddev | |||
volumes: | |||
db: |
@@ -0,0 +1,6 @@ | |||
#!/bin/bash | |||
# Set proper permissions and start webserver | |||
chown -R www-data:www-data /var/www/html && service apache2 start | |||
while sleep 1000; do :; done |
@@ -9,9 +9,10 @@ cp .devcontainer/codespace.config.php config/codespace.config.php | |||
# Set git safe.directory | |||
git config --global --add safe.directory /var/www/html | |||
git config --global --add safe.directory /var/www/html/3rdparty | |||
# Onetime installation setup | |||
if [ ! -f "data/.devcontainer-install-complete" ]; then | |||
if [[ ! $(sudo -u www-data php occ status) =~ installed:[[:space:]]*true ]]; then | |||
echo "Running NC installation" | |||
sudo -u www-data php occ maintenance:install \ | |||
--verbose \ | |||
@@ -22,9 +23,7 @@ if [ ! -f "data/.devcontainer-install-complete" ]; then | |||
--database-user=postgres \ | |||
--database-pass=postgres \ | |||
--admin-user admin \ | |||
--admin-pass admin && \ | |||
touch "data/.devcontainer-install-complete" | |||
--admin-pass admin | |||
fi | |||
# Clear caches and stuff ... | |||
service apache2 restart |