diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile deleted file mode 100644 index add3a5020..000000000 --- a/.devcontainer/Dockerfile +++ /dev/null @@ -1,21 +0,0 @@ -# [Choice] PHP version (use -bullseye variants on local arm64/Apple Silicon): 8, 8.1, 8.0, 7, 7.4, 7.3, 8-bullseye, 8.1-bullseye, 8.0-bullseye, 7-bullseye, 7.4-bullseye, 7.3-bullseye, 8-buster, 8.1-buster, 8.0-buster, 7-buster, 7.4-buster -ARG VARIANT=8-bullseye -FROM mcr.microsoft.com/vscode/devcontainers/php:${VARIANT} - -# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10 -ARG NODE_VERSION="none" -RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi - -RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ - && apt-get -y install --no-install-recommends zlib1g-dev libpng-dev libjpeg-dev libzip-dev - -# Adding PHP extensions -RUN docker-php-ext-configure gd --with-jpeg \ - && docker-php-ext-install \ - pdo_mysql \ - gd \ - zip \ - exif - -# [Optional] Uncomment this line to install global node packages. -# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g " 2>&1 diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index dc0df1594..eba20b021 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,61 +1,31 @@ // For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: // https://github.com/microsoft/vscode-dev-containers/tree/v0.195.0/containers/php { - "name": "PHP", - "build": { - "dockerfile": "Dockerfile", - "args": { - // Update VARIANT to pick a PHP version: 8, 8.1, 8.0, 7, 7.4, 7.3 - // Append -bullseye or -buster to pin to an OS version. - // Use -bullseye variants on local on arm64/Apple Silicon. - "VARIANT": "8.1", - "NODE_VERSION": "14" - } - }, "remoteEnv": { // Xdebug is disabled by default -- enable it by changing this env var, // see https://xdebug.org/docs/all_settings#mode "XDEBUG_MODE": "off" }, - // Configure tool-specific properties. + // // Configure tool-specific properties. "customizations": { // Configure properties specific to VS Code. "vscode": { - // Set *default* container specific settings.json values on container create. - "settings": { - "php.validate.executablePath": "/usr/local/bin/php" - }, // Add the IDs of extensions you want installed when the container is created. - "extensions": [ - "felixfbecker.php-debug", - "bmewburn.vscode-intelephense-client", - "esbenp.prettier-vscode", - "bradlc.vscode-tailwindcss", - "cjhowe7.laravel-blade" - ] + "extensions": ["esbenp.prettier-vscode", "bradlc.vscode-tailwindcss"] } }, - // Use 'forwardPorts' to make a list of ports inside the container available locally. - "forwardPorts": [ - 8000 - ], - // Use 'portsAttributes' to set default properties for specific forwarded ports. More info: https://code.visualstudio.com/docs/remote/devcontainerjson-reference. - "portsAttributes": { - "8000": { - "label": "Dev Server", - "onAutoForward": "notify" - } + + "image": "mcr.microsoft.com/devcontainers/php:8.2", + "features": { + "ghcr.io/opencodeco/devcontainers/install-php-extensions": { + "extensions": ["pdo_mysql gd exif"] + }, + "ghcr.io/devcontainers/features/node:1": { + "version": "20" + }, + "ghcr.io/devcontainers/features/docker-in-docker:2": {} }, - // Use 'otherPortsAttributes' to configure any ports that aren't configured using 'portsAttributes'. - // "otherPortsAttributes": { - // "onAutoForward": "silent" - // }, + // Use 'postCreateCommand' to run commands after the container is created. - // "postCreateCommand": "sudo chmod a+x \"$(pwd)\" && sudo rm -rf /var/www/html && sudo ln -s \"$(pwd)\" /var/www/html" - // Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. - "remoteUser": "vscode", - "mounts": [ - // Mount ~/.ssh in to allow SSH tunnelling - "source=${localEnv:HOME}${localEnv:USERPROFILE}/.ssh,target=/home/vscode/.ssh,type=bind,consistency=cached" - ] -} \ No newline at end of file + "postCreateCommand": ".devcontainer/post-create.sh" +} diff --git a/.devcontainer/post-create.sh b/.devcontainer/post-create.sh new file mode 100755 index 000000000..70a7f43ef --- /dev/null +++ b/.devcontainer/post-create.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +docker run -d \ + -p 9200:9200 \ + -e discovery.type=single-node \ + -e ES_JAVA_OPTS="-Xms1g -Xmx1g" \ + ghcr.io/slovaknationalgallery/elasticsearch-webumenia:7.17.3 + +docker run -d \ + -p 3306:3306 \ + -e MYSQL_DATABASE=webumenia_development \ + -e MYSQL_ALLOW_EMPTY_PASSWORD=1 \ + mysql:8.0.36 \ No newline at end of file