Update with latest definition
This commit is contained in:
@@ -1,46 +1,54 @@
|
|||||||
#-------------------------------------------------------------------------------------------------------------
|
# Update the VARIANT arg in devcontainer.json to pick a PHP version
|
||||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
ARG VARIANT=7
|
||||||
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
|
FROM php:${VARIANT}-cli
|
||||||
#-------------------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
FROM php:7-cli
|
# 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.
|
||||||
# Avoid warnings by switching to noninteractive
|
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
|
||||||
|
|
||||||
# This Dockerfile adds a non-root user with sudo access. Use the "remoteUser"
|
|
||||||
# property in devcontainer.json to use it. On Linux, the container user's GID/UIDs
|
|
||||||
# will be updated to match your local UID/GID (when using the dockerFile property).
|
|
||||||
# See https://aka.ms/vscode-remote/containers/non-root-user for details.
|
|
||||||
ARG USERNAME=vscode
|
ARG USERNAME=vscode
|
||||||
ARG USER_UID=1000
|
ARG USER_UID=1000
|
||||||
ARG USER_GID=$USER_UID
|
ARG USER_GID=$USER_UID
|
||||||
|
|
||||||
# Configure apt and install packages
|
# 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 \
|
RUN apt-get update \
|
||||||
&& apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \
|
&& export DEBIAN_FRONTEND=noninteractive \
|
||||||
#
|
&& apt-get -y install --no-install-recommends curl ca-certificates 2>&1 \
|
||||||
# install git iproute2, procps, lsb-release (useful for CLI installs)
|
&& curl -sSL ${COMMON_SCRIPT_SOURCE} -o /tmp/common-setup.sh \
|
||||||
&& apt-get -y install git openssh-client less iproute2 procps iproute2 lsb-release \
|
&& ([ "${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}" \
|
||||||
# Install xdebug
|
|
||||||
&& 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 \
|
|
||||||
#
|
|
||||||
# Create a non-root user to use if preferred - see https://aka.ms/vscode-remote/containers/non-root-user.
|
|
||||||
&& groupadd --gid $USER_GID $USERNAME \
|
|
||||||
&& useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \
|
|
||||||
# [Optional] Add sudo support for the non-root user
|
|
||||||
&& apt-get install -y sudo \
|
|
||||||
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME\
|
|
||||||
&& chmod 0440 /etc/sudoers.d/$USERNAME \
|
|
||||||
#
|
|
||||||
# Clean up
|
# Clean up
|
||||||
&& apt-get autoremove -y \
|
&& apt-get autoremove -y \
|
||||||
&& apt-get clean -y \
|
&& apt-get clean -y \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& 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"
|
||||||
|
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 /tmp/node-setup.sh; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
# [Optional] Uncomment this section to install additional packages.
|
||||||
|
# RUN apt-get update \
|
||||||
|
# && export DEBIAN_FRONTEND=noninteractive \
|
||||||
|
# && apt-get -y install --no-install-recommends <your-package-list-here>
|
||||||
|
|
||||||
# Switch back to dialog for any ad-hoc use of apt-get
|
|
||||||
ENV DEBIAN_FRONTEND=dialog
|
|
||||||
|
|||||||
@@ -1,25 +1,32 @@
|
|||||||
{
|
{
|
||||||
"name": "PHP Sample",
|
"name": "PHP Sample",
|
||||||
"dockerFile": "Dockerfile",
|
"build": {
|
||||||
|
"dockerfile": "Dockerfile",
|
||||||
|
"args": {
|
||||||
|
// Update VARIANT to pick a PHP version
|
||||||
|
"VARIANT": "7",
|
||||||
|
"INSTALL_NODE": "true",
|
||||||
|
"NODE_VERSION": "lts/*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
// Use 'settings' to set *default* container specific settings.json values on container create.
|
// Set *default* container specific settings.json values on container create.
|
||||||
"settings": {
|
"settings": {
|
||||||
"terminal.integrated.shell.linux": "/bin/bash"
|
"terminal.integrated.shell.linux": "/bin/bash"
|
||||||
},
|
},
|
||||||
|
|
||||||
// Add the IDs of extensions you want installed when the container is created in the array below.
|
// Add the IDs of extensions you want installed when the container is created.
|
||||||
"extensions": [
|
"extensions": [
|
||||||
"felixfbecker.php-debug",
|
"felixfbecker.php-debug",
|
||||||
"felixfbecker.php-intellisense"
|
"felixfbecker.php-intellisense"
|
||||||
],
|
],
|
||||||
|
|
||||||
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||||
// "forwardPorts": [],
|
// "forwardPorts": [],
|
||||||
|
|
||||||
// Use 'postCreateCommand' to run commands after the container is created.
|
// Use 'postCreateCommand' to run commands after the container is created.
|
||||||
// "postCreateCommand": "php -v",
|
// "postCreateCommand": "php -v",
|
||||||
|
|
||||||
// Comment out if you want to use root
|
// Comment out to use the root user instead. See https://aka.ms/vscode-remote/containers/non-root.
|
||||||
"remoteUser": "vscode"
|
"remoteUser": "vscode"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user