Last active
August 7, 2017 14:03
-
-
Save dasMulli/c791fd208be5dbdc28e57b019101d337 to your computer and use it in GitHub Desktop.
Sample asp.net core / .net core build setup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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