diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 342590b..35ab8f9 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,54 +1,15 @@ -# Update the VARIANT arg in devcontainer.json to pick a PHP version -ARG VARIANT=7 -FROM php:${VARIANT}-cli +# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.134.0/containers/php/.devcontainer/base.Dockerfile +ARG VARIANT="7" +FROM mcr.microsoft.com/vscode/devcontainers/php:0-${VARIANT} -# This Dockerfile adds a non-root user with sudo access. Update the “remoteUser” property in -# devcontainer.json to use it. More info: https://aka.ms/vscode-remote/containers/non-root-user. -ARG USERNAME=vscode -ARG USER_UID=1000 -ARG USER_GID=$USER_UID - -# Options for common setup script - SHA generated on release -ARG INSTALL_ZSH="true" -ARG UPGRADE_PACKAGES="false" -ARG COMMON_SCRIPT_SOURCE="https://raw.githubusercontent.com/microsoft/vscode-dev-containers/master/script-library/common-debian.sh" -ARG COMMON_SCRIPT_SHA="dev-mode" - -# Install needed packages and setup non-root user. Use a separate RUN statement to add your own dependencies. -RUN apt-get update \ - && export DEBIAN_FRONTEND=noninteractive \ - && apt-get -y install --no-install-recommends curl ca-certificates 2>&1 \ - && curl -sSL ${COMMON_SCRIPT_SOURCE} -o /tmp/common-setup.sh \ - && ([ "${COMMON_SCRIPT_SHA}" = "dev-mode" ] || (echo "${COMMON_SCRIPT_SHA} */tmp/common-setup.sh" | sha256sum -c -)) \ - && /bin/bash /tmp/common-setup.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" \ - # Clean up - && apt-get autoremove -y \ - && apt-get clean -y \ - && rm -rf /var/lib/apt/lists/* /tmp/common-setup.sh - -# Install xdebug -RUN yes | pecl install xdebug \ - && echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini \ - && echo "xdebug.remote_enable=on" >> /usr/local/etc/php/conf.d/xdebug.ini \ - && echo "xdebug.remote_autostart=on" >> /usr/local/etc/php/conf.d/xdebug.ini - -# [Optional] Install Node.js for use with web applications - update the INSTALL_NODE arg in devcontainer.json to enable. -ARG INSTALL_NODE="false" -ARG NODE_SCRIPT_SOURCE="https://raw.githubusercontent.com/microsoft/vscode-dev-containers/master/script-library/node-debian.sh" -ARG NODE_SCRIPT_SHA="dev-mode" +# [Optional] Install a version of Node.js using nvm for front end dev +ARG INSTALL_NODE="true" ARG NODE_VERSION="lts/*" -ENV NVM_DIR=/usr/local/share/nvm -ENV NVM_SYMLINK_CURRENT=true -ENV PATH=${NVM_DIR}/current/bin:${PATH} -RUN if [ "$INSTALL_NODE" = "true" ]; then \ - curl -sSL ${NODE_SCRIPT_SOURCE} -o /tmp/node-setup.sh \ - && ([ "${NODE_SCRIPT_SHA}" = "dev-mode" ] || (echo "${COMMON_SCRIPT_SHA} */tmp/node-setup.sh" | sha256sum -c -)) \ - && /bin/bash /tmp/node-setup.sh "${NVM_DIR}" "${NODE_VERSION}" "${USERNAME}" \ - && rm -rf /var/lib/apt/lists/* /tmp/node-setup.sh; \ - fi +RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "source /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi -# [Optional] Uncomment this section to install additional packages. -# RUN apt-get update \ -# && export DEBIAN_FRONTEND=noninteractive \ +# [Optional] Uncomment this section to install additional OS packages. +# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ # && apt-get -y install --no-install-recommends +# [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 \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index eaf98b6..f5efd17 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,11 +1,13 @@ +// For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.134.0/containers/php { - "name": "PHP Sample", + "name": "PHP", "build": { "dockerfile": "Dockerfile", "args": { - // Update VARIANT to pick a PHP version + // Update VARIANT to pick a PHP version: 7, 7.4, 7.3 "VARIANT": "7", - "INSTALL_NODE": "true", + "INSTALL_NODE": "false", "NODE_VERSION": "lts/*" } }, @@ -27,6 +29,6 @@ // Use 'postCreateCommand' to run commands after the container is created. // "postCreateCommand": "php -v", - // Comment out to use the root user instead. See https://aka.ms/vscode-remote/containers/non-root. + // Comment out to connect as root instead. "remoteUser": "vscode" }