microsoft / AmbariBasedHadoopExporter

Exporter based on Hadoop clusters that use Ambari as their administrative tool, leveraging Ambari API to export cluster's metrics.
MIT License
20 stars 16 forks source link

App folder location #12

Closed xadcoh closed 4 years ago

xadcoh commented 4 years ago

By default app is copied to root folder and caused an error:

Unhandled Exception: System.UnauthorizedAccessException: Access to the path '/proc/1/map_files' is denied. ---> System.IO.IOException: Operation not permitted

To fix this set WORKDIR for runtime container in Dockerfile:

FROM microsoft/dotnet:2.2-sdk AS build-env
WORKDIR /app

# -------------- Step 1. Copy only required files for nuget restore for better caching
# 1.1 Copy solution & nuget config file (if exists)
COPY *.sln NuGet*.Config ./
# 1.2 Copy csproj and create folders for projects
COPY ./src/*/*.csproj ./
# 1.3 Create folders for projects
RUN for file in $(ls *.csproj); do mkdir -p src/${file%.*} && mv $file src/${file%.*}/; done
# 1.4 Copy tests
COPY ./test/*/*.csproj ./
# 1.5 Create projects for tests
RUN for file in $(ls *.csproj); do mkdir -p test/${file%.*} && mv $file test/${file%.*}/; done
# 1.6 Restore
RUN dotnet restore

# -------------- Step 2. Copy all other files
COPY . .

# -------------- Step 3. Build all
RUN dotnet build -c Release --no-restore

# TODO Support flag test=false
# TODO Export test xml results  files
# -------------- Step 4. Run tests
RUN dotnet vstest test/*/bin/Release/*/*Tests.dll

#-------------- Step 5. Build runtime image
RUN dotnet publish src/App -c Release -o /app/out --no-restore

FROM microsoft/dotnet:2.2-runtime
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "App.dll"]
SolomonTomer commented 4 years ago

Hey @xadcoh ,

You are right, I've added the missing WORKDIR definition.

Thanks