Skip to content

Instantly share code, notes, and snippets.

@abdurrahman
Created November 30, 2022 10:55
Show Gist options
  • Save abdurrahman/c0ac66aeedefe5a692a28d4ff0965912 to your computer and use it in GitHub Desktop.
Save abdurrahman/c0ac66aeedefe5a692a28d4ff0965912 to your computer and use it in GitHub Desktop.
How to install tool internally with non-root user Dockerfile
FROM mcr.microsoft.com/dotnet/sdk:6.0.300-bullseye-slim
ENV EF_VERSION=7.0.0
ENV user dotnetuser
ENV PATH=/opt/bin:${PATH}
RUN dotnet tool install dotnet-ef --tool-path /opt/bin --version ${EF_VERSION}
WORKDIR /src
COPY ["./YourApplicationFolder", "."]
RUN adduser --disabled-password \
--home /src \
--gecos '' ${user} && chown -R ${user} /src
HEALTHCHECK NONE
USER ${user}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment