Skip to content

Commit 5ad5dab

Browse files
committed
feat(dev): add devcontainers setup
1 parent 3b95fff commit 5ad5dab

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

.devcontainer/Dockerfile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
FROM php:7.4-cli
2+
3+
# Install system dependencies
4+
RUN apt-get update && apt-get install -y \
5+
zip \
6+
unzip \
7+
git \
8+
&& rm -rf /var/lib/apt/lists/*
9+
10+
# Install Composer
11+
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
12+
&& php composer-setup.php \
13+
&& mv composer.phar /usr/local/bin/composer \
14+
&& php -r "unlink('composer-setup.php');" \
15+
&& chmod +x /usr/local/bin/composer
16+
17+
# Create a non-root user
18+
ARG USERNAME=upsun
19+
ARG USER_UID=1000
20+
ARG USER_GID=$USER_UID
21+
22+
RUN groupadd --gid $USER_GID $USERNAME \
23+
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
24+
&& apt-get update \
25+
&& apt-get install -y sudo \
26+
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
27+
&& chmod 0440 /etc/sudoers.d/$USERNAME
28+
29+
USER $USERNAME

.devcontainer/devcontainer.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "Upsun CLI",
3+
"build": {
4+
"dockerfile": "Dockerfile"
5+
},
6+
"remoteUser": "upsun",
7+
"postCreateCommand": "composer install"
8+
}

0 commit comments

Comments
 (0)