bdcp
bdcp
CC#
Created by bdcp on 6/24/2024 in #help
Docker non-root access volume for runtime image
I have this Dockerfile
FROM mcr.microsoft.com/dotnet/runtime:8.0 AS base

USER app
RUN mkdir /home/app/data
WORKDIR /home/app

COPY ./publish .

ENTRYPOINT ["dotnet", "MyProject.dll"]
FROM mcr.microsoft.com/dotnet/runtime:8.0 AS base

USER app
RUN mkdir /home/app/data
WORKDIR /home/app

COPY ./publish .

ENTRYPOINT ["dotnet", "MyProject.dll"]
Something like File.WriteAllText("/home/app/data/file.txt", "lorem ipsum") get permission denied when the volume is mounted in linux
docker run --rm \
-v ./testdata:/home/app/data \
-e RUN_ON_STARTUP=true \
$image_name
docker run --rm \
-v ./testdata:/home/app/data \
-e RUN_ON_STARTUP=true \
$image_name
I've tried many things related to docker. I suspect it's how the dotnet/runtime image is setup might be the issue. But i'm not that advanced. Ideally, i would like to save the file to /data instead of /home/app/data
6 replies
CC#
Created by bdcp on 10/7/2023 in #help
❔ Substitute interface property?
I have this interface:
public interface IAzureBlobStorage
{
UsersContext Users { get; }
}
public interface IAzureBlobStorage
{
UsersContext Users { get; }
}
And i'm trying to do some method chaining. But .Users is NULL, substitute doesnt overwrite that.
var azureBlobStorage = Substitute.For<IAzureBlobStorage>();

azureBlobStorage
.Users
.WithId(Arg.Any<Guid>())
.GetProfileImageOrDefault()
.Returns(Substitute.For<BlobClient>());
var azureBlobStorage = Substitute.For<IAzureBlobStorage>();

azureBlobStorage
.Users
.WithId(Arg.Any<Guid>())
.GetProfileImageOrDefault()
.Returns(Substitute.For<BlobClient>());
Any way i can make this work with NSubstitute?
5 replies
CC#
Created by bdcp on 6/26/2023 in #help
❔ Writing tests for Minimal API that calls KeyVault and Azure
4 replies