Skip to content

Instantly share code, notes, and snippets.

@raffraffraff
Last active June 21, 2020 09:15
Show Gist options
  • Save raffraffraff/8730cec12205c7c1e9736b8b36312dfb to your computer and use it in GitHub Desktop.
Save raffraffraff/8730cec12205c7c1e9736b8b36312dfb to your computer and use it in GitHub Desktop.
Interactive Dockerfile testing
# Run the FROM image interactively with the current directory mounted to /build_dir
# Eg, for python:3.8-alpine...
docker run -it -v /path/to/build_dir:/build_dir --entrypoint=/bin/sh python:3.8-alpine
# Once inside the container interactively, set up some functions that enable the shell to 'run' the Dockerfile
FROM() {
echo FROM $*
}
ENV() {
export $1=$2
}
RUN() {
$*
}
COPY() {
cp -a /build_dir/$1 $2
}
# Now, you can simply copy/paste the contents of the Dockerfile and they should run. You can build on this of course, this is just a quick gist to get you started
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment