Skip to content

Commit 1ba5d69

Browse files
committed
building
1 parent 8af2f6b commit 1ba5d69

File tree

4 files changed

+60
-33
lines changed

4 files changed

+60
-33
lines changed

Dockerfile

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,24 @@ COPY --from=pgloader-builder /build/pgloader/build/bin/pgloader /usr/bin/pgloade
3535
RUN \
3636
curl -LsSf https://astral.sh/uv/install.sh | sh
3737
RUN \
38-
npm install -g concurrently opencode-ai
39-
RUN \
40-
curl -sL https://raw.githubusercontent.com/apache/openserverless-cli/refs/heads/main/install.sh | bash \
41-
&& mv ~/.local/bin/ops /usr/local/bin/ops
38+
npm install -g npm
4239

43-
# remove node
4440
RUN userdel node ; rm -Rvf /home/node
45-
ENV HOME=/home
41+
ENV OPS_HOME=/home
4642
ENV OPS_BRANCH=main
47-
ADD start.sh /start.sh
43+
ENV PATH=/home/.local/bin:/usr/local/bin:/usr/bin:/bin
44+
RUN printf "OPS_HOME=$OPS_HOME\nOPS_BRANCH=$OPS_BRANCH\nPATH=$PATH\n" >/etc/environment
45+
RUN \
46+
export HOME=/home ;\
47+
curl -sL https://raw.githubusercontent.com/apache/openserverless-cli/refs/heads/main/install.sh | bash ;\
48+
ops -t ;\
49+
git clone https://github.com/apache/openserverless-devcontainer $HOME/.ops/openserverless-devcontainer ;\
50+
ln -sf $HOME/.ops/openserverless-devcontainer/olaris-tk $HOME/.ops/olaris-tk
51+
52+
ADD supervisord.ini /etc/supervisord.ini
53+
ADD start.sh /usr/local/bin/start.sh
4854

55+
RUN mkdir /home/workspace
56+
WORKDIR /home/workspace
4957
ENTRYPOINT ["tini", "--"]
50-
CMD ["/start.sh"]
51-
RUN mkdir /workspace
52-
WORKDIR /workspace
58+
CMD ["/usr/local/bin/start.sh"]

Taskfile.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ tasks:
1515
image-tag:
1616
- git tag -d "$(git tag)" || true
1717
- git tag "0.1.0-incubating.$(date +%y%m%d%H%M)"
18-
- task: show
18+
- echo {{.NAME}}:$(git tag --sort=-creatordate | head -n 1)
1919

2020
build:
2121
- docker build -t "{{.NAME}}:{{.TAG}}" . --load

start.sh

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,28 @@
44
mkdir -p /run/sshd
55
ssh-keygen -A
66

7-
export PORT1=${SSH_PORT:-2222}
8-
export PORT2=${OPENCODE_PORT:-2223}
7+
# update ops
8+
export OPS_HOME=/home
9+
ops -update
910

10-
# setup user
11-
export HOME=/home
12-
if test -n "$USERID"
13-
then
14-
useradd -u "$USERID" -d /home -o -U user -s /bin/bash
15-
ops -update
16-
git clone https://github.com/apache/openserverless-devcontainer $HOME/.ops/openserverless-devcontainer
17-
ln -sf $HOME/.ops/openserverless-devcontainer/olaris-tk $HOME/.ops/olaris-tk
11+
# setup user workspace
12+
export HOME=/home/workspace
13+
if test -z "$USERID"
14+
then USERID=1000
15+
fi
16+
/usr/sbin/useradd -u "$USERID" -d $HOME -o -U -s /bin/bash workspace
1817

19-
if test -n "$SSHKEY"
20-
then
21-
mkdir -p $HOME/.ssh
22-
echo "$SSHKEY" >>$HOME/.ssh/authorized_keys
23-
chmod 600 ~/.ssh/authorized_keys
24-
fi
25-
chown -Rvf "$USERID" /home
18+
# add ssh key
19+
if test -n "$SSHKEY"
20+
then
21+
mkdir -p $HOME/.ssh
22+
echo "$SSHKEY" >>$HOME/.ssh/authorized_keys
23+
chmod 600 ~/.ssh/authorized_keys
2624
fi
27-
cd /workspace
28-
echo Starting ssh in port $PORT1 and opencode in $PORT2 for user $USERID
29-
concurrently \
30-
"sudo /usr/sbin/sshd -p $PORT1 -D" \
31-
"opencode serve -p $PORT2 --hostname 0.0.0.0"
25+
26+
# fix permissions
27+
chown -Rf "$USERID" /home
28+
29+
# start supervisor
30+
supervisord -c /etc/supervisord.ini
3231

supervisord.ini

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[supervisord]
2+
nodaemon=true
3+
logfile=/dev/stdout
4+
logfile_maxbytes=0
5+
pidfile=/tmp/supervisord.pid
6+
user=root
7+
8+
[program:sshd]
9+
command=/usr/sbin/sshd -p 2222 -D
10+
directory=/
11+
user=root
12+
autostart=true
13+
autorestart=true
14+
startretries=10
15+
stdout_logfile=/dev/stdout
16+
stdout_logfile_maxbytes=0
17+
stderr_logfile=/dev/stderr
18+
stderr_logfile_maxbytes=0
19+
stopsignal=TERM
20+
stopasgroup=true
21+
killasgroup=true
22+

0 commit comments

Comments
 (0)