Skip to content

Commit

Permalink
Update docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
damianh committed Mar 28, 2021
1 parent 33881b8 commit 97bae52
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 12 deletions.
16 changes: 16 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
**/bin/
**/obj/
**/global.json
**/Dockerfile*
**/.dockerignore*
**/*.user
**/*.Custom.json
**/*.CustomDotSettings
.idea/
.vs/
.vscode/
.git/
adr/
artifacts/
temp/
**/_NCrunch_*
Empty file added .editorconfig
Empty file.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/

# StyleCop
StyleCopReport.xml
Expand Down
4 changes: 4 additions & 0 deletions artifacts/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore
25 changes: 18 additions & 7 deletions build.cmd
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
@ECHO OFF

docker run --rm -it --name hosting-build ^
:: Builds the build environment image.
docker build ^
-f build.dockerfile ^
--tag dotnet-libs-build .

if errorlevel 1 (
echo Docker build failed: Exit code is %errorlevel%
exit /b %errorlevel%
)

docker run --rm -it --name dotnet-libs-build ^
-v /var/run/docker.sock:/var/run/docker.sock ^
-v %cd%:/repo ^
-w /repo ^
-e FEEDZ_LOGICALITY_API_KEY=%FEEDZ_LOGICALITY_API_KEY% ^
--network host ^
-v %cd%/artifacts:/repo/artifacts ^
-v %cd%/.git:/repo/.git ^
-v %cd%/temp:/repo/temp ^
-e NUGET_PACKAGES=/repo/temp/nuget-packages ^
-e BUILD_NUMBER=%GITHUB_RUN_NUMBER% ^
damianh/dotnet-sdks:6 ^
dotnet run -p build/build.csproj -c Release -- %*
--network host ^
dotnet-libs-build ^
dotnet run -p build/Build.csproj -c Release -- %*

if errorlevel 1 (
echo Docker build failed: Exit code is %errorlevel%
Expand Down
5 changes: 5 additions & 0 deletions build.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM damianh/dotnet-sdks:6

COPY . ./repo/

WORKDIR /repo
13 changes: 9 additions & 4 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@

set -e

docker build \
-f build.dockerfile \
--tag dotnet-libs-build .

docker run --rm --name hosting-build \
-v /var/run/docker.sock:/var/run/docker.sock \
-v $PWD:/repo \
-w /repo \
-e FEEDZ_LOGICALITY_API_KEY=$FEEDZ_LOGICALITY_API_KEY \
-v $PWD/artifacts:/repo/artifacts \
-v $PWD/.git:/repo/.git \
-v $PWD/temp:/repo/temp \
-e NUGET_PACKAGES=/repo/temp/nuget-packages \
-e BUILD_NUMBER=$GITHUB_RUN_NUMBER \
--network host \
damianh/dotnet-sdks:6 \
dotnet-libs-build \
dotnet run -p build/Build.csproj -c Release -- "$@"
4 changes: 4 additions & 0 deletions temp/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

0 comments on commit 97bae52

Please sign in to comment.