diff --git a/Docker/appsettings.json b/Docker/appsettings.json new file mode 100644 index 00000000..e581ac93 --- /dev/null +++ b/Docker/appsettings.json @@ -0,0 +1,3 @@ +{ + "LibationFiles": "/config" +} diff --git a/Docker/liberate.sh b/Docker/liberate.sh index 83249b87..036d629d 100755 --- a/Docker/liberate.sh +++ b/Docker/liberate.sh @@ -19,18 +19,6 @@ fi echo "" -# Check if the config directory is passed in, and there is no link to it then create the link. -if [ -d "/config" ] && [ ! -d "/root/Libation" ]; then - echo "Linking config directory to the Libation config directory" - ln -s /config/ /root/Libation -fi - -# If no config error and exit -if [ ! -d "/config" ]; then - echo "ERROR: No /config directory. You must pass in a volume containing your config mapped to /config" - exit 1 -fi - # If user passes in db from a /db/ folder and a db does not already exist / is not already linked FILE=/db/LibationContext.db if [ -f "${FILE}" ] && [ ! -f "/config/LibationContext.db" ]; then @@ -38,12 +26,6 @@ if [ -f "${FILE}" ] && [ ! -f "/config/LibationContext.db" ]; then ln -s $FILE /config/LibationContext.db fi -# Confirm we have a db in the config direcotry. -if [ ! -f "/config/LibationContext.db" ]; then - echo "ERROR: No Libation database detected, exiting." - exit 1 -fi - # ################################ # Loop and liberate # ################################ @@ -65,4 +47,4 @@ do sleep "${SLEEP_TIME}" done -echo "Exiting" \ No newline at end of file +echo "Exiting" diff --git a/Dockerfile b/Dockerfile index ef274842..c976b3c2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Dockerfile -FROM mcr.microsoft.com/dotnet/sdk:8.0 as build-env +FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env COPY Source /Source RUN dotnet publish -c Release -o /Source/bin/Publish/Linux-chardonnay /Source/LibationCli/LibationCli.csproj -p:PublishProfile=/Source/LibationCli/Properties/PublishProfiles/LinuxProfile.pubxml @@ -7,16 +7,21 @@ COPY Docker/liberate.sh /Source/bin/Publish/Linux-chardonnay FROM mcr.microsoft.com/dotnet/runtime:8.0 +ARG USER_UID=1001 -ENV SLEEP_TIME "30m" -# Sets the character set that will be used for folder and filenames when liberating -ENV LANG C.UTF-8 -ENV LC_ALL C.UTF-8 +ENV SLEEP_TIME=30m -RUN mkdir /db /config /data +# Set the character set that will be used for folder and filenames when liberating +ENV LANG=C.UTF-8 +ENV LC_ALL=C.UTF-8 + +RUN apt-get update && apt-get -y upgrade && \ + mkdir /db /config /data COPY --from=build-env /Source/bin/Publish/Linux-chardonnay /libation +COPY Docker/appsettings.json /libation/ +USER ${USER_UID} CMD ["./libation/liberate.sh"]