Skip to content

Instantly share code, notes, and snippets.

@magickatt
Created August 10, 2021 15:36
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 magickatt/77a49fa9432e0124eeb05636e32e20db to your computer and use it in GitHub Desktop.
Save magickatt/77a49fa9432e0124eeb05636e32e20db to your computer and use it in GitHub Desktop.
Use forwarded SSH agent in Docker build
FROM python:3.9-buster
# Prevents issues with cloning private PIP packages from GitHub
RUN --mount=type=ssh mkdir -p ~/.ssh && ssh-keyscan -H github.com >> ~/.ssh/known_hosts
RUN pip install --upgrade pip
RUN pip install pipenv
COPY . .
# Use the forwarded SSH agent when installing pip packages
RUN --mount=type=ssh pipenv install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment