Aug. 25, 2023, 10:35 p.m. | Giancarlo Rocha

DEV Community dev.to




Introduction


This quick guide will show you how to mount a ssh key inside a container in build time, to allow you to install private dependencies, that won't be persisted in the final image. It uses python but could work with any language/package manager that uses git + ssh.





Dockerfile


First you need to set Dockerfile syntax to docker/dockerfile:1.2. Put this in the beggining of the file:



# syntax = docker/dockerfile:1.2


Now install git and openssh, and setup ssh …

build dependencies devops docker git guide image inside install introduction language manager package python security show ssh work

Software Engineer for AI Training Data (School Specific)

@ G2i Inc | Remote

Software Engineer for AI Training Data (Python)

@ G2i Inc | Remote

Software Engineer for AI Training Data (Tier 2)

@ G2i Inc | Remote

Data Engineer

@ Lemon.io | Remote: Europe, LATAM, Canada, UK, Asia, Oceania

Artificial Intelligence – Bioinformatic Expert

@ University of Texas Medical Branch | Galveston, TX

Lead Developer (AI)

@ Cere Network | San Francisco, US