Skip to content

Commit

Permalink
Avoid KoreBuild issues when using dockerbuild.sh
Browse files Browse the repository at this point in the history
- avoid MSB4011 warnings (about repeated Directory.Build.targets imports)
    - place `$DOTNET_HOME` beside repo root, not under it
- cherry-picked from #30729 internal branch for image update

nits:
- use current Docker image for 2.1 alpine
- set `$LANGUAGE` with other locale-related environment variables
  • Loading branch information
dougbu committed Apr 8, 2021
1 parent c15fee6 commit 2a8b114
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion build/docker/alpine.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM microsoft/dotnet:2.1.0-preview1-runtime-deps-alpine
FROM mcr.microsoft.com/dotnet/runtime-deps:2.1-alpine
ARG USER
ARG USER_ID
ARG GROUP_ID
Expand All @@ -18,10 +18,14 @@ RUN apk add --no-cache \

USER $USER_ID:$GROUP_ID

# Use a location for .dotnet/ that's not under repo root.
ENV DOTNET_HOME /code/.dotnet

# Disable the invariant mode (set in base image)
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT false
ENV LC_ALL en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US.UTF-8

# Skip package initilization
ENV DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
4 changes: 4 additions & 0 deletions dockerbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ fi
dockerfile="$DIR/build/docker/$image.Dockerfile"
tagname="aspnetcore-build-$image"

# Use a location for .dotnet/ that's not under repo root in the container and don't reuse host's folder.
mkdir "$(dirname $DIR)/.dotnet-$image"

docker build "$(dirname "$dockerfile")" \
--build-arg "USER=$(whoami)" \
--build-arg "USER_ID=$(id -u)" \
Expand All @@ -114,6 +117,7 @@ docker run \
-e PB_ASSETROOTURL \
-e PRODUCTBUILDID \
-v "$DIR:/code/build" \
-v "$(dirname $DIR)/.dotnet-$image:/code/.dotnet" \
${docker_args[@]+"${docker_args[@]}"} \
$tagname \
./build.sh \
Expand Down

0 comments on commit 2a8b114

Please sign in to comment.