Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Sample asp.net core / .net core build setup
#!/bin/bash
SOURCE="${BASH_SOURCE[0]}"
SRC_DIR="$(cd -P "$(dirname "$SOURCE")"&&pwd)"
WORKDIR="/usr/src"
IMAGENAME="microsoft/aspnetcore-build"
COMMAND="./build.sh"
docker pull "$IMAGENAME"
docker run --rm -w "$WORKDIR" -v "$SRC_DIR":"$WORKDIR" -- "$IMAGENAME" $COMMAND
#!/bin/bash
SOURCE="${BASH_SOURCE[0]}"
SRC_DIR="$(cd -P "$(dirname "$SOURCE")"&&pwd)"
BUILD_PROJ="${SRC_DIR}/build.proj"
#Exit script on error
set -o errexit
# Fix ownership of output files when run with docker
finish() {
user_id=$(stat -c '%u:%g' "${SRC_DIR}")
chown -R ${user_id} "${SRC_DIR}"
echo "Cleaned up file permissions..."
}
trap finish EXIT
echo "Performing build..."
dotnet msbuild "${BUILD_PROJ}"
echo "Build script succeeded."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment