-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
Copy pathDockerFile
54 lines (36 loc) · 1.64 KB
/
DockerFile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
ARG DOTNET_VERSION=8.0.400
FROM mcr.microsoft.com/dotnet/sdk:${DOTNET_VERSION} AS elasticsearch-net-build
ENV NUGET_SCRATCH="/tmp/NuGetScratch"
ARG USER_ID
ARG GROUP_ID
RUN echo addgroup --gid $GROUP_ID user
RUN addgroup --gid $GROUP_ID user
RUN adduser --disabled-password --gecos '' --uid $USER_ID --gid $GROUP_ID user
WORKDIR /sln
RUN chown $GROUP_ID:$USER_ID $(pwd)
COPY ./*.sln ./nuget.config ./*.Build.props ./*.Build.targets ./
COPY ./dotnet-tools.json ./
# todo standardize on Build.props as Directory.Build.props needs that form
COPY ./src/*.Build.props ./src/
COPY ./tests/*.Build.props ./tests/
# Copy the main source project files
COPY src/*/*.?sproj ./src/
COPY tests/*/*.?sproj ./tests/
COPY benchmarks/*/*.?sproj ./benchmarks/
# this puts the project files back into original location since COPY flattens
RUN for file in $(find . -name "*.?sproj"); do echo mkdir -p $(dirname $file)/$(basename ${file%.*})/ && echo mv $file $(dirname $file)/$(basename ${file%.*})/; done
RUN for file in $(find . -name "*.?sproj"); do mkdir -p $(dirname $file)/$(basename ${file%.*})/ && mv $file $(dirname $file)/$(basename ${file%.*})/; done
# copy these manually since these do not follow a pattern under src or tests
COPY build/scripts/scripts.fsproj ./build/scripts/
COPY .ci/Jenkins.csproj ./.ci/
# Install app dependencies
RUN dotnet restore
RUN dotnet tool restore
RUN chown -R $GROUP_ID:$USER_ID $(pwd)
RUN chown -R $GROUP_ID:$USER_ID /tmp/NuGetScratch
# copy relevant files (see .dockerignore)
COPY . .
# making sure enough git info is available inside the container
RUN git config --global --add safe.directory '*'
RUN git rev-parse HEAD .
# USER user