Skip to content

Commit

Permalink
update dockerfile and build script for build image
Browse files Browse the repository at this point in the history
  • Loading branch information
arroyc committed May 23, 2019
1 parent 180d85c commit 7d2ec92
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 14 deletions.
9 changes: 2 additions & 7 deletions build/build-buildimages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ source $REPO_DIR/build/__variables.sh

cd "$BUILD_IMAGES_BUILD_CONTEXT_DIR"

declare BUILDSCRIPT_SOURCE="buildscriptbuilder"
declare BUILD_SIGNED=""

echo "SignType is: "$SIGNTYPE
Expand All @@ -22,12 +21,9 @@ echo "SignType is: "$SIGNTYPE
if [ "$SIGNTYPE" == "real" ] || [ "$SIGNTYPE" == "Real" ]
then
# "SignType" will be real only for builds by scheduled and/or manual builds of ORYX-CI
BUILDSCRIPT_SOURCE="copybuildscriptbinaries"
# BUILDSCRIPT_SOURCE="copybuildscriptbinaries"
BUILD_SIGNED="true"
ls -l $BUILD_IMAGES_BUILD_CONTEXT_DIR
else
# locally we need to fake "binaries" directory to get a successful "copybuildscriptbinaries" build stage
mkdir -p $BUILD_IMAGES_BUILD_CONTEXT_DIR/binaries
fi

# Avoid causing cache invalidation with the following check
Expand Down Expand Up @@ -60,14 +56,13 @@ BuildAndTagStage node-install
BuildAndTagStage dotnet-install
BuildAndTagStage python
BuildAndTagStage buildscriptbuilder
BuildAndTagStage copybuildscriptbinaries
# BuildAndTagStage copybuildscriptbinaries
BuildAndTagStage buildscriptbinaries

builtImageTag="$DOCKER_BUILD_IMAGES_REPO:latest"
docker build -t $builtImageTag \
--build-arg AI_KEY=$APPLICATION_INSIGHTS_INSTRUMENTATION_KEY \
--build-arg AGENTBUILD=$BUILD_SIGNED \
--build-arg BUILDSCRIPT_SOURCE=$BUILDSCRIPT_SOURCE \
$ctxArgs -f "$BUILD_IMAGES_DOCKERFILE" .

echo
Expand Down
10 changes: 3 additions & 7 deletions images/build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Start declaration of Build-Arg to determine where the image is getting built (devops agents or local)
ARG BUILDSCRIPT_SOURCE=buildscriptbuilder
ARG AGENTBUILD
FROM buildpack-deps:stretch AS main
# End declaration of Build-Arg to determine where the image is getting built (devops agents or local)
Expand Down Expand Up @@ -265,17 +264,14 @@ ENV GIT_COMMIT=${GIT_COMMIT}
ENV BUILD_NUMBER=${BUILD_NUMBER}
RUN if [ -z "$AGENTBUILD" ]; then \
dotnet publish -r linux-x64 -o /opt/buildscriptgen/ -c Release BuildScriptGeneratorCli/BuildScriptGeneratorCli.csproj; \
else \
cp -rf binaries/. /opt/buildscriptgen/; \
fi

# This stage is only when building in devops agents
FROM main AS copybuildscriptbinaries
COPY binaries /opt/buildscriptgen/

# This stage copies oryx binaries from specific build stage, for local/dev it copies
# from "buildscriptbuilder" and for devops it copies from "copybuildscriptbinaries"
# https://github.com/moby/moby/issues/34482
FROM ${BUILDSCRIPT_SOURCE} AS buildscriptbinaries
ARG BUILDSCRIPT_SOURCE
FROM buildscriptbuilder AS buildscriptbinaries
WORKDIR /usr/oryx/src
ARG GIT_COMMIT=unspecified
ARG BUILD_NUMBER=unspecified
Expand Down
1 change: 1 addition & 0 deletions vsts/pipelines/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ jobs:

- job: Job_RuntimeImages
displayName: Build and Test Runtime Images
dependsOn: Job_SignBinaries
condition: succeeded()
pool:
name: OryxLinux
Expand Down

0 comments on commit 7d2ec92

Please sign in to comment.