You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openserverless.apache.org by ms...@apache.org on 2026/09/12 07:15:11 UTC
(openserverless-devcontainer) 02/02: cleanup devcontainer
This is an automated email from the ASF dual-hosted git repository.
sciabarracom pushed a commit to branch 0.9.0
in repository https://gitbox.apache.org/repos/asf/openserverless-devcontainer.git
commit dbab8aab00182c57f79bf8fa7beee150cfef3c98
Author: Michele Sciabarra <mi...@sciabarra.com>
AuthorDate: Sat Sep 12 09:14:06 2026 +0200
cleanup devcontainer
---
Dockerfile | 21 ++++++++++-----------
Taskfile.yml | 13 ++++++++++++-
start.sh | 19 ++++---------------
3 files changed, 26 insertions(+), 27 deletions(-)
diff --git a/Dockerfile b/Dockerfile
index 8f7d7a5..9b19f7d 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -15,7 +15,11 @@
# specific language governing permissions and limitations
# under the License.
+FROM golang:1.27 AS builder
+RUN go install github.com/apache/openserverless-cli/cmd/ops@0.9.0
+
FROM node:22
+COPY --from=builder /go/bin/ops /usr/local/bin/ops
ARG DEVCONTAINER_IMAGE_DEFAULT=docker.io/apache/openserverless-devcontainer
ARG DEVCONTAINER_TAG_DEFAULT=latest
@@ -25,7 +29,8 @@ RUN \
curl -sSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - && \
apt update && \
apt install -y less sudo jq nano python-is-python3 python3-virtualenv \
- locales postgresql-client-16 openssh-server tini supervisor
+ locales postgresql-client-16 openssh-server tini supervisor && \
+ rm -rf /var/lib/apt/lists/*
# setup env
RUN \
@@ -34,21 +39,15 @@ RUN \
locale-gen en_US.UTF-8 && \
update-locale ANG=en_US.UTF-8 LANGUAGE=en_US.UTF-8 LC_ALL=en_US.UTF-8
-RUN userdel node ; rm -Rvf /home/node
-ENV HOME=/home
-ENV OPS_HOME=/home
-ENV OPS_BRANCH=main
+ENV HOME=/home/openserverless
ENV PATH=/home/.local/bin:/usr/local/bin:/usr/bin:/bin
-RUN printf "OPS_HOME=$OPS_HOME\nOPS_BRANCH=$OPS_BRANCH\nPATH=$PATH\n" >/etc/environment
-RUN \
- curl -sL https://raw.githubusercontent.com/apache/openserverless-cli/refs/heads/main/install.sh | bash ;\
- ops -t
+RUN /usr/local/bin/ops -t
ADD supervisord.ini /etc/supervisord.ini
ADD start.sh /usr/local/bin/start.sh
-RUN mkdir /home/workspace
-WORKDIR /home/workspace
+RUN mkdir -p /home/openserverless
+WORKDIR /home/openserverless
# Apache release metadata (see DISCLAIMER, LICENSE, NOTICE, WARN)
COPY DISCLAIMER LICENSE NOTICE /
diff --git a/Taskfile.yml b/Taskfile.yml
index 9822499..44ba1a8 100644
--- a/Taskfile.yml
+++ b/Taskfile.yml
@@ -165,4 +165,15 @@ tasks:
license:
desc: check license
cmds:
- - license-eye header check
\ No newline at end of file
+ - license-eye header check
+
+ test:
+ desc: testing locally
+ vars:
+ KEY:
+ sh: echo $HOME/.ssh/id_rsa.pub
+ cmds:
+ - test -e {{.KEY}} || { echo 'missing {{.KEY}}' ; exit 1; }
+ - docker rm -f devcontainer
+ - docker run -d --name devcontainer -p 2222:2222 -e SSHKEY="$(cat {{.KEY}})" {{.DEVCONTAINER_IMAGE}}:{{.TAG}}
+ - echo "access devcontainer with ssh -p 2222 openserverless@localhost, terminate with docker rm devcontainer"
\ No newline at end of file
diff --git a/start.sh b/start.sh
index 16b6eae..a8d94ed 100755
--- a/start.sh
+++ b/start.sh
@@ -16,21 +16,17 @@
# specific language governing permissions and limitations
# under the License.
+export HOME=/home/openserverless
#setup sshd
mkdir -p /run/sshd
ssh-keygen -A
-# update ops
-export HOME=/home
-export OPS_HOME=/home
-ops -update
-
# setup user workspace
if test -z "$USERID"
then USERID=1000
fi
-/usr/sbin/useradd -u "$USERID" -d $HOME -o -U -s /bin/bash devel
+/usr/sbin/useradd -u "$USERID" -d $HOME -o -U -s /bin/bash openserverless
# add ssh key
if test -n "$SSHKEY"
@@ -44,20 +40,13 @@ then
chmod 700 $HOME/.ssh
fi
-touch ~/.bashrc
+touch $HOME/.bashrc
echo ARCH="$(dpkg --print-architecture)" >>~/.bashrc
echo 'export PATH="$HOME/.local/bin:$HOME:$HOME/.ops/linux-$ARCH/bin:$PATH"' >>~/.bashrc
-if [ -n "$OPS_PASSWORD" ] && [ -n "$OPS_USER" ] && [ -n "$OPS_APIHOST" ]
-then
- cd $HOME
- echo -e "OPS_USER=$OPS_USER\nOPS_PASSWORD=$OPS_PASSWORD\nOPS_APIHOST=$OPS_APIHOST\n" >.env
- ops ide login
-fi
-
# fix permissions
chmod 0755 $HOME
-chown -Rf "$USERID" /home
+chown -Rf "$USERID" $HOME
# start supervisor
supervisord -c /etc/supervisord.ini