Skip to content

Commit

Permalink
chore: packaging hacks
Browse files Browse the repository at this point in the history
  • Loading branch information
ibuildthecloud committed Oct 25, 2024
1 parent 6ce4e24 commit 3508c55
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 9 deletions.
19 changes: 15 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ RUN --mount=type=cache,id=pnpm,target=/root/.local/share/pnpm/store \
make in-docker-build

# Second Stage: Final
FROM ubuntu:22.04
FROM cgr.dev/chainguard/wolfi-base AS final

RUN apt-get update && apt install -y git tini openssh-server
# Install build dependencies
RUN apk add --no-cache git py3.12-pip openssh-server nodejs bash tini
RUN ln -s /usr/bin/python3.12 /usr/bin/python3

RUN sed -E 's/^#(PermitRootLogin)no/\1yes/' /etc/ssh/sshd_config -i
RUN ssh-keygen -A
Expand All @@ -28,17 +30,26 @@ RUN mkdir /run/sshd && /usr/sbin/sshd
# Copy the compiled application from the builder stage
COPY --from=builder /app/bin/otto8 /bin/
COPY --link --from=builder /app/otto8-tools /otto8-tools
RUN <<EOF
for i in $(find /otto8-tools/[^k]* -name requirements.txt -exec cat {} \; -exec echo \; | sort -u); do
pip install "$i"
done
EOF
COPY --chmod=0755 <<EOF /bin/run.sh
#!/bin/bash
set -e
mkdir -p /run/sshd
/usr/sbin/sshd -D &
mkdir -p /data/cache
ln -sf /otto8-tools /data/cache/system
exec tini -- otto8 server
EOF

EXPOSE 22
ENV HOME=/data
ENV OTTO_SERVER_TOOL_REGISTRY=/otto8-tools
ENV OTTO_SERVER_WORKSPACE_TOOL=/otto8-tools/workspace-provider
ENV XDG_CACHE_HOME=/data/cache
ENV OTTO_SERVER_TOOL_REGISTRY=/data/cache/system
ENV OTTO_SERVER_WORKSPACE_TOOL=/data/cache/system/workspace-provider
WORKDIR /data
VOLUME /data
CMD ["run.sh"]
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ require (
github.com/google/uuid v1.6.0
github.com/gptscript-ai/cmd v0.0.0-20240907001148-ffd49061124a
github.com/gptscript-ai/go-gptscript v0.9.6-0.20241023195750-c09e0f56b39b
github.com/gptscript-ai/gptscript v0.9.6-0.20241023192603-dd84ea22db09
github.com/gptscript-ai/gptscript v0.9.6-0.20241025060327-519883a07af7
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de
github.com/oauth2-proxy/oauth2-proxy/v7 v7.0.0-00010101000000-000000000000
github.com/otto8-ai/otto8/apiclient v0.0.0-00010101000000-000000000000
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,8 @@ github.com/gptscript-ai/cmd v0.0.0-20240907001148-ffd49061124a h1:LX7AOcbBoTnUk/
github.com/gptscript-ai/cmd v0.0.0-20240907001148-ffd49061124a/go.mod h1:DJAo1xTht1LDkNYFNydVjTHd576TC7MlpsVRl3oloVw=
github.com/gptscript-ai/go-gptscript v0.9.6-0.20241023195750-c09e0f56b39b h1:EDd5OCtZ43YVSzKuQlXLiXCIQ6qhsrqLqY5Ows5ohlY=
github.com/gptscript-ai/go-gptscript v0.9.6-0.20241023195750-c09e0f56b39b/go.mod h1:/FVuLwhz+sIfsWUgUHWKi32qT0i6+IXlUlzs70KKt/Q=
github.com/gptscript-ai/gptscript v0.9.6-0.20241023192603-dd84ea22db09 h1:xL89MPEuDuhPhxmH09NCHJWE6Q1TBsUUXafWaiFkz8c=
github.com/gptscript-ai/gptscript v0.9.6-0.20241023192603-dd84ea22db09/go.mod h1:+CC86EbcmMMBgvv5NBqHzep63SobtB5vhNOq4i6aPrA=
github.com/gptscript-ai/gptscript v0.9.6-0.20241025060327-519883a07af7 h1:2LrFv6EHEu1R2Wz+4k90oyuiPOiDmOA70neQvDOwN3U=
github.com/gptscript-ai/gptscript v0.9.6-0.20241025060327-519883a07af7/go.mod h1:+CC86EbcmMMBgvv5NBqHzep63SobtB5vhNOq4i6aPrA=
github.com/gptscript-ai/tui v0.0.0-20240923192013-172e51ccf1d6 h1:vkgNZVWQgbE33VD3z9WKDwuu7B/eJVVMMPM62ixfCR8=
github.com/gptscript-ai/tui v0.0.0-20240923192013-172e51ccf1d6/go.mod h1:frrl/B+ZH3VSs3Tqk2qxEIIWTONExX3tuUa4JsVnqx4=
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 h1:pdN6V1QBWetyv/0+wjACpqVH+eVULgEjkurDLq3goeM=
Expand Down
31 changes: 29 additions & 2 deletions tools/package-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ set -e -x

cd $(dirname $0)/..

git clone --depth=1 https://github.com/otto8-ai/tools otto8-tools
if [ ! -e otto8-tools ]; then
git clone --depth=1 https://github.com/otto8-ai/tools otto8-tools
fi

for gomod in $(find otto8-tools -name go.mod); do
if [ $(basename $(dirname $gomod)) == common ]; then
Expand All @@ -16,7 +18,32 @@ for gomod in $(find otto8-tools -name go.mod); do
)
done

for pj in $(find otto8-tools -name package.json | grep -v node_modules); do
if [ $(basename $(dirname $pj)) == common ]; then
continue
fi
(
cd $(dirname $pj)
echo Building $PWD
pnpm i
)
done

cd otto8-tools
git clone --depth=1 https://github.com/gptscript-ai/workspace-provider
if [ ! -e workspace-provider ]; then
git clone --depth=1 https://github.com/gptscript-ai/workspace-provider
fi

cd workspace-provider
go build -o bin/gptscript-go-tool .

cd ..
if [ ! -e knowledge-tool ]; then
git clone https://github.com/gptscript-ai/knowledge knowledge-tool
fi
cd knowledge-tool
make
ln -s knowledge bin/gptscript-go-tool

cd ..
sed -e 's!github.com/gptscript-ai/knowledge!./knowledge-tool!g' -e 's/@main//g' -i index.yaml

0 comments on commit 3508c55

Please sign in to comment.