diff --git a/Dockerfile b/Dockerfile index f69bd103c4..7fcada6415 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,6 +32,11 @@ FROM mcr.microsoft.com/dotnet/runtime:8.0 AS runtime WORKDIR /app COPY --from=build /app . +RUN mkdir /data \ + && chown -R $APP_UID:$APP_UID /data + +VOLUME /data + # Run container as a non-root user USER $APP_UID diff --git a/Dockerfile.alpine b/Dockerfile.alpine index fad023fe7b..1bfe28226d 100644 --- a/Dockerfile.alpine +++ b/Dockerfile.alpine @@ -32,6 +32,11 @@ FROM mcr.microsoft.com/dotnet/runtime:8.0-alpine AS runtime WORKDIR /app COPY --from=build /app . +RUN mkdir /data \ + && chown -R $APP_UID:$APP_UID /data + +VOLUME /data + # Run container as a non-root user USER $APP_UID diff --git a/Dockerfile.cbl-mariner b/Dockerfile.cbl-mariner index df50788740..979eca86fe 100644 --- a/Dockerfile.cbl-mariner +++ b/Dockerfile.cbl-mariner @@ -32,6 +32,11 @@ FROM mcr.microsoft.com/dotnet/runtime:8.0-cbl-mariner2.0 AS runtime WORKDIR /app COPY --from=build /app . +RUN mkdir /data \ + && chown -R $APP_UID:$APP_UID /data + +VOLUME /data + # Run container as a non-root user USER $APP_UID diff --git a/Dockerfile.chiseled b/Dockerfile.chiseled index fbe26fb02a..d78e0971a0 100644 --- a/Dockerfile.chiseled +++ b/Dockerfile.chiseled @@ -32,6 +32,8 @@ FROM mcr.microsoft.com/dotnet/runtime:8.0-jammy-chiseled AS runtime WORKDIR /app COPY --from=build /app . +VOLUME /data + # For inter-container communication. EXPOSE 6379 diff --git a/Dockerfile.ubuntu b/Dockerfile.ubuntu index 490347f8d4..93e6743605 100644 --- a/Dockerfile.ubuntu +++ b/Dockerfile.ubuntu @@ -32,6 +32,11 @@ FROM mcr.microsoft.com/dotnet/runtime:8.0-jammy AS runtime WORKDIR /app COPY --from=build /app . +RUN mkdir /data \ + && chown -R $APP_UID:$APP_UID /data + +VOLUME /data + # Run container as a non-root user USER $APP_UID