-
Notifications
You must be signed in to change notification settings - Fork 128
feat(dev): add devcontainers setup #1585
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -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 pcntl extension (required for CLI) | |
| RUN docker-php-ext-install -j$(nproc) pcntl |
Copilot
AI
Nov 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Composer installation lacks signature verification, which is a security concern. The existing Dockerfile in the repository uses a more secure installation method that verifies the installer signature. Consider using the same approach from docker/install_composer.sh or at minimum verify the installer signature before running it.
| # 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 | |
| # Install Composer (with signature verification) | |
| RUN set -eux; \ | |
| EXPECTED_SIGNATURE="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')" ; \ | |
| php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" ; \ | |
| ACTUAL_SIGNATURE="$(php -r "echo hash_file('SHA384', 'composer-setup.php');")" ; \ | |
| if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ]; then \ | |
| echo 'ERROR: Invalid installer signature' >&2; \ | |
| rm -f composer-setup.php; \ | |
| exit 1; \ | |
| fi; \ | |
| php composer-setup.php; \ | |
| mv composer.phar /usr/local/bin/composer; \ | |
| php -r "unlink('composer-setup.php');"; \ | |
| chmod +x /usr/local/bin/composer |
Copilot
AI
Nov 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
apt-get update is called twice unnecessarily (line 4 and line 24), which is inefficient and slows down image builds. Consider combining all apt-get installations into a single RUN command or removing the cleanup on line 8 and doing it after the final apt-get install on line 25.
Copilot
AI
Nov 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Dockerfile is missing a WORKDIR directive. The main project Dockerfile sets WORKDIR /home/psh/legacy-cli (line 23 in Dockerfile), which defines where the code will be mounted and where commands will run. Consider adding a similar WORKDIR for the devcontainer, e.g., WORKDIR /home/upsun/workspace or an appropriate path.
| USER $USERNAME | |
| USER $USERNAME | |
| # Set the working directory | |
| WORKDIR /home/upsun/workspace | |
| # Ensure the workspace directory exists | |
| RUN mkdir -p /home/upsun/workspace |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "name": "Upsun CLI", | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think let's figure this out when we merge to |
||
| "build": { | ||
| "dockerfile": "Dockerfile" | ||
| }, | ||
| "remoteUser": "upsun", | ||
| "postCreateCommand": "composer install" | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing system dependencies that are present in the main project Dockerfile:
wgetandopenssh-client(see lines 7-8 inDockerfile). These are likely needed for the CLI's functionality, such as SSH access to environments and downloading resources. Add them to the apt-get install command on lines 4-8.