Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

False positive for Docker error AC_DOCKER_0013 - workaround is to remove quotes when call WORKDIR #1643

Open
weldevops opened this issue Nov 16, 2023 · 1 comment

Comments

@weldevops
Copy link

  • terrascan version: 1.18.0.1
  • Operating System: Microsoft Windows Server 2022, 10.0.20348

Description

Running terrascan against the web application template in Visual Studio results in error AC_DOCKER_0013: Ensure the use absolute paths for your WORKDIR. This refers to the default Dockerfile that is created:

FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
USER app
WORKDIR /app
EXPOSE 8080
EXPOSE 8081

FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["WebApplication1/WebApplication1.csproj", "WebApplication1/"]
RUN dotnet restore "./WebApplication1/./WebApplication1.csproj"
COPY . .
WORKDIR "/src/WebApplication1"
RUN dotnet build "./WebApplication1.csproj" -c $BUILD_CONFIGURATION -o /app/build

FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./WebApplication1.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "WebApplication1.dll"]

What I Did

Changing WORKDIR "/src/WebApplication1" to WORKDIR /src/WebApplication1 without the quotes resolves the error.

@RenanFG
Copy link

RenanFG commented Feb 20, 2024

I have the same Issue, my path has white space so I cant just remove the quotes

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants