Skip to content

Instantly share code, notes, and snippets.

@markrendle
Created February 22, 2016 19:24
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 markrendle/0cc08b5e915c6f32b4ef to your computer and use it in GitHub Desktop.
Save markrendle/0cc08b5e915c6f32b4ef to your computer and use it in GitHub Desktop.
Docker script to run `dnx` commands using CoreCLR
#! /usr/bin/env bash
WORKDIR=''
PROJECTDIR=$PWD
while [ ! -f "${PROJECTDIR}/global.json" ] ; do
WORKDIR="/$(basename $PROJECTDIR)${WORKDIR}"
PROJECTDIR=$(dirname $PROJECTDIR)
if [ $PROJECTDIR == '/' ] ; then
echo No global.json found in any parent directories. Aborting.
exit 1
fi
done
docker run --rm \
-v="${PROJECTDIR}:/project" \
-v "${HOME}/.dnx:/root/.dnx" \
-w="/project${WORKDIR}" \
--entrypoint="dnx" \
microsoft/aspnet:1.0.0-rc1-update1-coreclr $@

CoreCLR doesn't work on my Arch Linux install, so this script runs dnx commands in a Docker container using the official Microsoft ASP.NET CoreCLR image.

I'm just using it for running tests in CoreCLR, but you could tweak it to serve webs by adding some sort of port mapping.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment