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: add clone-key option for local with private go modules #257

Merged
merged 2 commits into from
Jul 23, 2024
Merged
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
11 changes: 11 additions & 0 deletions dockerfile/cosmos/local.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@ ARG BUILD_DIR

ADD ${BUILD_DIR}/go.mod ${BUILD_DIR}/go.sum ./

ARG CLONE_KEY

RUN if [ ! -z "${CLONE_KEY}" ]; then\
mkdir -p ~/.ssh;\
echo "${CLONE_KEY}" | base64 -d > ~/.ssh/id_ed25519;\
chmod 600 ~/.ssh/id_ed25519;\
apk add openssh;\
git config --global --add url."ssh://[email protected]/".insteadOf "https://github.com/";\
ssh-keyscan github.com >> ~/.ssh/known_hosts;\
fi

# Download go mod dependencies, if there is no custom build directory
# Note: a custom build dir indicates a monorepo with potential dependencies we can't anticipate atm
RUN set -eux; \
Expand Down
15 changes: 12 additions & 3 deletions dockerfile/cosmos/localcross.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,32 @@ RUN if [ "${TARGETARCH}" = "arm64" ] && [ "${BUILDARCH}" != "arm64" ]; then\
ARG GITHUB_ORGANIZATION
ARG REPO_HOST

WORKDIR /go/src/${REPO_HOST}/${GITHUB_ORGANIZATION}
WORKDIR /go/src/${REPO_HOST}/${GITHUB_ORGANIZATION}/${GITHUB_REPO}

ARG GITHUB_REPO
ARG VERSION
ARG BUILD_TIMESTAMP

ADD . .

WORKDIR /go/src/${REPO_HOST}/${GITHUB_ORGANIZATION}/${GITHUB_REPO}

ARG BUILD_TARGET
ARG BUILD_ENV
ARG BUILD_TAGS
ARG PRE_BUILD
ARG BUILD_DIR
ARG WASMVM_VERSION

ARG CLONE_KEY

RUN if [ ! -z "${CLONE_KEY}" ]; then\
mkdir -p ~/.ssh;\
echo "${CLONE_KEY}" | base64 -d > ~/.ssh/id_ed25519;\
chmod 600 ~/.ssh/id_ed25519;\
apk add openssh;\
git config --global --add url."ssh://[email protected]/".insteadOf "https://github.com/";\
ssh-keyscan github.com >> ~/.ssh/known_hosts;\
fi

RUN set -eux;\
LIBDIR=/lib;\
if [ "${TARGETARCH}" = "arm64" ]; then\
Expand Down
Loading