Skip to content
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

[Feat] SSH Server opt-in #763

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions runtimes/8.0/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=UTC
ENV SUPERVISOR_PHP_COMMAND="/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan serve --host=0.0.0.0 --port=80"
ENV SUPERVISOR_PHP_USER="sail"
ENV SUPERVISOR_SSH_COMMAND="/usr/sbin/sshd -D"

RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

Expand Down Expand Up @@ -60,6 +61,14 @@ RUN userdel -r ubuntu
RUN groupadd --force -g $WWWGROUP sail
RUN useradd -ms /bin/bash --no-user-group -g $WWWGROUP -u 1337 sail

RUN apt-get update && apt-get upgrade -y \
&& apt-get install -y openssh-server \
&& apt-get -y autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN mkdir /var/run/sshd
RUN sed -i 's/#PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config

COPY start-container /usr/local/bin/start-container
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY php.ini /etc/php/8.0/cli/conf.d/99-sail.ini
Expand Down
4 changes: 4 additions & 0 deletions runtimes/8.0/start-container
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ if [ ! -z "$WWWUSER" ]; then
usermod -u $WWWUSER sail
fi

if [ ! -z "$SSH_PASSWORD" ]; then
echo "sail:$SSH_PASSWORD" | chpasswd
fi

if [ ! -d /.composer ]; then
mkdir /.composer
fi
Expand Down
9 changes: 9 additions & 0 deletions runtimes/8.0/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,12 @@ stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

[program:ssh]
command=%(ENV_SUPERVISOR_SSH_COMMAND)s
user=root
environment=LARAVEL_SAIL="1"
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
9 changes: 9 additions & 0 deletions runtimes/8.1/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=UTC
ENV SUPERVISOR_PHP_COMMAND="/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan serve --host=0.0.0.0 --port=80"
ENV SUPERVISOR_PHP_USER="sail"
ENV SUPERVISOR_SSH_COMMAND="/usr/sbin/sshd -D"

RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

Expand Down Expand Up @@ -59,6 +60,14 @@ RUN userdel -r ubuntu
RUN groupadd --force -g $WWWGROUP sail
RUN useradd -ms /bin/bash --no-user-group -g $WWWGROUP -u 1337 sail

RUN apt-get update && apt-get upgrade -y \
&& apt-get install -y openssh-server \
&& apt-get -y autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN mkdir /var/run/sshd
RUN sed -i 's/#PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config

COPY start-container /usr/local/bin/start-container
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY php.ini /etc/php/8.1/cli/conf.d/99-sail.ini
Expand Down
4 changes: 4 additions & 0 deletions runtimes/8.1/start-container
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ if [ ! -z "$WWWUSER" ]; then
usermod -u $WWWUSER sail
fi

if [ ! -z "$SSH_PASSWORD" ]; then
echo "sail:$SSH_PASSWORD" | chpasswd
fi

if [ ! -d /.composer ]; then
mkdir /.composer
fi
Expand Down
9 changes: 9 additions & 0 deletions runtimes/8.1/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,12 @@ stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

[program:ssh]
command=%(ENV_SUPERVISOR_SSH_COMMAND)s
user=root
environment=LARAVEL_SAIL="1"
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
9 changes: 9 additions & 0 deletions runtimes/8.2/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=UTC
ENV SUPERVISOR_PHP_COMMAND="/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan serve --host=0.0.0.0 --port=80"
ENV SUPERVISOR_PHP_USER="sail"
ENV SUPERVISOR_SSH_COMMAND="/usr/sbin/sshd -D"

RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

Expand Down Expand Up @@ -60,6 +61,14 @@ RUN userdel -r ubuntu
RUN groupadd --force -g $WWWGROUP sail
RUN useradd -ms /bin/bash --no-user-group -g $WWWGROUP -u 1337 sail

RUN apt-get update && apt-get upgrade -y \
&& apt-get install -y openssh-server \
&& apt-get -y autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN mkdir /var/run/sshd
RUN sed -i 's/#PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config

COPY start-container /usr/local/bin/start-container
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY php.ini /etc/php/8.2/cli/conf.d/99-sail.ini
Expand Down
4 changes: 4 additions & 0 deletions runtimes/8.2/start-container
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ if [ ! -z "$WWWUSER" ]; then
usermod -u $WWWUSER sail
fi

if [ ! -z "$SSH_PASSWORD" ]; then
echo "sail:$SSH_PASSWORD" | chpasswd
fi

if [ ! -d /.composer ]; then
mkdir /.composer
fi
Expand Down
9 changes: 9 additions & 0 deletions runtimes/8.2/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,12 @@ stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

[program:ssh]
command=%(ENV_SUPERVISOR_SSH_COMMAND)s
user=root
environment=LARAVEL_SAIL="1"
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
9 changes: 9 additions & 0 deletions runtimes/8.3/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=UTC
ENV SUPERVISOR_PHP_COMMAND="/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan serve --host=0.0.0.0 --port=80"
ENV SUPERVISOR_PHP_USER="sail"
ENV SUPERVISOR_SSH_COMMAND="/usr/sbin/sshd -D"

RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

Expand Down Expand Up @@ -61,6 +62,14 @@ RUN userdel -r ubuntu
RUN groupadd --force -g $WWWGROUP sail
RUN useradd -ms /bin/bash --no-user-group -g $WWWGROUP -u 1337 sail

RUN apt-get update && apt-get upgrade -y \
&& apt-get install -y openssh-server \
&& apt-get -y autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN mkdir /var/run/sshd
RUN sed -i 's/#PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config

COPY start-container /usr/local/bin/start-container
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY php.ini /etc/php/8.3/cli/conf.d/99-sail.ini
Expand Down
4 changes: 4 additions & 0 deletions runtimes/8.3/start-container
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ if [ ! -z "$WWWUSER" ]; then
usermod -u $WWWUSER sail
fi

if [ ! -z "$SSH_PASSWORD" ]; then
echo "sail:$SSH_PASSWORD" | chpasswd
fi

if [ ! -d /.composer ]; then
mkdir /.composer
fi
Expand Down
9 changes: 9 additions & 0 deletions runtimes/8.3/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,12 @@ stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

[program:ssh]
command=%(ENV_SUPERVISOR_SSH_COMMAND)s
user=root
environment=LARAVEL_SAIL="1"
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
9 changes: 9 additions & 0 deletions runtimes/8.4/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=UTC
ENV SUPERVISOR_PHP_COMMAND="/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan serve --host=0.0.0.0 --port=80"
ENV SUPERVISOR_PHP_USER="sail"
ENV SUPERVISOR_SSH_COMMAND="/usr/sbin/sshd -D"

RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

Expand Down Expand Up @@ -62,6 +63,14 @@ RUN userdel -r ubuntu
RUN groupadd --force -g $WWWGROUP sail
RUN useradd -ms /bin/bash --no-user-group -g $WWWGROUP -u 1337 sail

RUN apt-get update && apt-get upgrade -y \
&& apt-get install -y openssh-server \
&& apt-get -y autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN mkdir /var/run/sshd
RUN sed -i 's/#PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config

COPY start-container /usr/local/bin/start-container
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY php.ini /etc/php/8.4/cli/conf.d/99-sail.ini
Expand Down
4 changes: 4 additions & 0 deletions runtimes/8.4/start-container
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ if [ ! -z "$WWWUSER" ]; then
usermod -u $WWWUSER sail
fi

if [ ! -z "$SSH_PASSWORD" ]; then
echo "sail:$SSH_PASSWORD" | chpasswd
fi

if [ ! -d /.composer ]; then
mkdir /.composer
fi
Expand Down
9 changes: 9 additions & 0 deletions runtimes/8.4/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,12 @@ stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

[program:ssh]
command=%(ENV_SUPERVISOR_SSH_COMMAND)s
user=root
environment=LARAVEL_SAIL="1"
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
2 changes: 2 additions & 0 deletions stubs/docker-compose.stub
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ services:
extra_hosts:
- 'host.docker.internal:host-gateway'
ports:
# - '${SSH_PORT:-2222}:22'
- '${APP_PORT:-80}:80'
- '${VITE_PORT:-5173}:${VITE_PORT:-5173}'
environment:
# SSH_PASSWORD:
WWWUSER: '${WWWUSER}'
LARAVEL_SAIL: 1
XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}'
Expand Down