Skip to content

Commit 34a8036

Browse files
committed
Add GITHUB_TOKEN env support
1 parent 5f00834 commit 34a8036

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

packages/opencode/Dockerfile

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ FROM alpine AS base
44
# On ephemeral containers, the cache is not useful
55
ARG BUN_RUNTIME_TRANSPILER_CACHE_PATH=0
66
ENV BUN_RUNTIME_TRANSPILER_CACHE_PATH=${BUN_RUNTIME_TRANSPILER_CACHE_PATH}
7-
RUN apk add libgcc libstdc++ ripgrep git
7+
RUN apk add libgcc libstdc++ ripgrep git openssh-client
88

99
FROM base AS build-amd64
1010
COPY dist/shuvcode-linux-x64-baseline-musl/bin/shuvcode /usr/local/bin/shuvcode
@@ -16,5 +16,14 @@ COPY static /usr/local/bin/static
1616

1717
ARG TARGETARCH
1818
FROM build-${TARGETARCH}
19+
20+
# Create entrypoint script that configures git credentials if GITHUB_TOKEN is set
21+
RUN printf '#!/bin/sh\n\
22+
if [ -n "$GITHUB_TOKEN" ]; then\n\
23+
git config --global credential.helper "!f() { echo username=x-access-token; echo password=$GITHUB_TOKEN; }; f"\n\
24+
git config --global url."https://github.com/".insteadOf "git@github.com:"\n\
25+
fi\n\
26+
exec shuvcode "$@"\n' > /usr/local/bin/entrypoint.sh && chmod +x /usr/local/bin/entrypoint.sh
27+
1928
RUN shuvcode --version
20-
ENTRYPOINT ["shuvcode"]
29+
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]

0 commit comments

Comments
 (0)