diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 000000000..0a6c8f516 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,29 @@ +FROM php:7.4-cli + +# Install system dependencies +RUN apt-get update && apt-get install -y \ + zip \ + unzip \ + git \ + && rm -rf /var/lib/apt/lists/* + +# Install Composer +RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \ + && php composer-setup.php \ + && mv composer.phar /usr/local/bin/composer \ + && php -r "unlink('composer-setup.php');" \ + && chmod +x /usr/local/bin/composer + +# Create a non-root user +ARG USERNAME=upsun +ARG USER_UID=1000 +ARG USER_GID=$USER_UID + +RUN groupadd --gid $USER_GID $USERNAME \ + && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \ + && apt-get update \ + && apt-get install -y sudo \ + && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ + && chmod 0440 /etc/sudoers.d/$USERNAME + +USER $USERNAME diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000..703074519 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,8 @@ +{ + "name": "Upsun CLI", + "build": { + "dockerfile": "Dockerfile" + }, + "remoteUser": "upsun", + "postCreateCommand": "composer install" +} \ No newline at end of file