Skip to content

Instantly share code, notes, and snippets.

@erkolson
Created March 24, 2018 00:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erkolson/47d6fc1337975da0a80c231b5a5d43e8 to your computer and use it in GitHub Desktop.
Save erkolson/47d6fc1337975da0a80c231b5a5d43e8 to your computer and use it in GitHub Desktop.
Copy credentials into build container for git cloning, etc
FROM iron/go:dev as builder
ARG GH_TOKEN=default
RUN echo "machine github.com" > "/root/.netrc" \
&& \
echo "login x-oath-basic" >> "/root/.netrc" \
&& \
echo "password $GH_TOKEN" >> "/root/.netrc" \
&& \
chmod 600 /root/.netrc
# Do go get; go build, etc
# create deployment image
FROM alpine
RUN apk add --no-cache ca-certificates
COPY --from=builder path/to/binary /bin/binary
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment