aboutsummaryrefslogtreecommitdiffstats
path: root/.devcontainer
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2021-02-01 12:17:04 +0000
committerGitHub <noreply@github.com>2021-02-08 16:55:01 +0000
commit7f983cc5496ca398dfdef90d96fd0e1958371e56 (patch)
tree902d1aa19129cfb0d8e278134d1d097e10d56ca8 /.devcontainer
parent26a20ed13f782418b37c16681a7ad7a0c8e943b6 (diff)
downloadnextcloud-server-7f983cc5496ca398dfdef90d96fd0e1958371e56.tar.gz
nextcloud-server-7f983cc5496ca398dfdef90d96fd0e1958371e56.zip
Add initial support for GitHub codespaces
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
Diffstat (limited to '.devcontainer')
-rw-r--r--.devcontainer/Dockerfile39
-rw-r--r--.devcontainer/codespace.config.php9
-rw-r--r--.devcontainer/devcontainer.json19
-rw-r--r--.devcontainer/docker-compose.yml29
-rwxr-xr-x.devcontainer/setup.sh8
5 files changed, 104 insertions, 0 deletions
diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile
new file mode 100644
index 00000000000..9eeda50ef92
--- /dev/null
+++ b/.devcontainer/Dockerfile
@@ -0,0 +1,39 @@
+FROM ubuntu:focal
+
+ARG DEBIAN_FRONTEND=noninteractive
+
+# PHP
+RUN apt-get update -y
+RUN apt-get install --no-install-recommends -y \
+ php7.4 \
+ php7.4-gd \
+ php7.4-zip \
+ php7.4-curl \
+ php7.4-xml \
+ php7.4-mbstring \
+ php7.4-sqlite \
+ php7.4-xdebug \
+ php7.4-pgsql \
+ php7.4-intl \
+ curl \
+ vim \
+ lsof
+
+RUN echo "xdebug.remote_enable = 1" >> /etc/php/7.4/cli/conf.d/20-xdebug.ini
+RUN echo "xdebug.remote_autostart = 1" >> /etc/php/7.4/cli/conf.d/20-xdebug.ini
+
+# Docker
+RUN apt-get -y install \
+ apt-transport-https \
+ ca-certificates \
+ curl \
+ gnupg-agent \
+ software-properties-common
+RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
+RUN add-apt-repository \
+ "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
+ $(lsb_release -cs) \
+ stable"
+RUN apt-get update -y
+RUN apt-get install -y docker-ce docker-ce-cli containerd.io
+RUN ln -s /var/run/docker-host.sock /var/run/docker.sock
diff --git a/.devcontainer/codespace.config.php b/.devcontainer/codespace.config.php
new file mode 100644
index 00000000000..9c1730b3c9c
--- /dev/null
+++ b/.devcontainer/codespace.config.php
@@ -0,0 +1,9 @@
+<?php
+
+$cloudEnvironmentId = getenv('CLOUDENV_ENVIRONMENT_ID');
+
+if($cloudEnvironmentId !== false) {
+ $CONFIG = array (
+ 'overwritehost' => $cloudEnvironmentId . '-80.apps.codespaces.githubusercontent.com',
+ );
+}
diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
new file mode 100644
index 00000000000..a820364d73d
--- /dev/null
+++ b/.devcontainer/devcontainer.json
@@ -0,0 +1,19 @@
+{
+ "name": "NextcloudServer",
+ "dockerComposeFile": "docker-compose.yml",
+ "service": "nextclouddev",
+ "postCreateCommand": ".devcontainer/setup.sh",
+ "forwardPorts": [
+ 80,
+ 8080,
+ 8025
+ ],
+ "runArgs": [
+ "--privileged"
+ ],
+ "extensions": [
+ "felixfbecker.php-debug",
+ "felixfbecker.php-intellisense",
+ "ms-azuretools.vscode-docker"
+ ],
+} \ No newline at end of file
diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml
new file mode 100644
index 00000000000..ada819429f4
--- /dev/null
+++ b/.devcontainer/docker-compose.yml
@@ -0,0 +1,29 @@
+version: '3'
+services:
+ nextclouddev:
+ build: .
+ volumes:
+ - .:/workspace:cached
+ - /var/run/docker.sock:/var/run/docker-host.sock
+ command: /bin/sh -c "while sleep 1000; do :; done"
+ ports:
+ - 80:80
+ - 8080:8080
+ - 8025:8025
+
+ db:
+ image: postgres
+ restart: always
+ environment:
+ POSTGRES_PASSWORD: postgres
+ network_mode: service:nextclouddev
+
+ adminer:
+ image: adminer
+ restart: always
+ network_mode: service:nextclouddev
+
+ mailhog:
+ image: mailhog/mailhog
+ restart: always
+ network_mode: service:nextclouddev
diff --git a/.devcontainer/setup.sh b/.devcontainer/setup.sh
new file mode 100755
index 00000000000..9d2e3d73f98
--- /dev/null
+++ b/.devcontainer/setup.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../" >/dev/null 2>&1 && pwd )"
+
+cd $DIR/
+git submodule update --init
+
+# Codespace config
+cp .devcontainer/codespace.config.php config/codespace.config.php