Last active
February 25, 2024 23:25
-
-
Save cedws/24a90913df631d271a59bbc1ff992de9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ docker build --ssh default . | |
$ docker build --secret id=netrc,src=netrc --build-arg CI=1 . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM golang:latest | |
WORKDIR /build | |
COPY . . | |
ARG GITHUB_HOST_KEY_ED25519="AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl" | |
ARG CI | |
ARG GIT_CONFIG_COUNT=${CI:+0} | |
ENV GIT_CONFIG_COUNT ${GIT_CONFIG_COUNT:-1} | |
ENV GIT_CONFIG_KEY_0 "url.ssh://[email protected]" | |
ENV GIT_CONFIG_VALUE_0 "https://github.com" | |
RUN mkdir ~/.ssh | |
COPY <<-EOF /root/.ssh/known_hosts | |
github.com ssh-ed25519 ${GITHUB_HOST_KEY_ED25519} | |
EOF | |
RUN --mount=type=secret,id=netrc,dst=/root/.netrc \ | |
--mount=type=ssh \ | |
go mod tidy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
machine github.com | |
password ${PAT} | |
login oauth2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment