From 1b27d0b46d035886afe4c1f237a9294f03322a76 Mon Sep 17 00:00:00 2001 From: Gabe Kangas Date: Sun, 11 Apr 2021 19:43:29 -0700 Subject: [PATCH] Do not copy data dir on build. Create data dir if needed on launch --- build/release/Dockerfile-build | 2 +- main.go | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/build/release/Dockerfile-build b/build/release/Dockerfile-build index 4ad4cd228..6c6587e6a 100644 --- a/build/release/Dockerfile-build +++ b/build/release/Dockerfile-build @@ -24,5 +24,5 @@ WORKDIR /app COPY --from=build /build/owncast /app/owncast COPY --from=build /build/webroot /app/webroot COPY --from=build /build/static /app/static -COPY --from=build /build/data /app/data +RUN mkdir /app/data CMD ["/app/owncast"] diff --git a/main.go b/main.go index aea4390b7..3a51fcd87 100644 --- a/main.go +++ b/main.go @@ -2,6 +2,7 @@ package main import ( "flag" + "os" "strconv" "time" @@ -56,6 +57,11 @@ func main() { } log.Infoln(config.GetReleaseString()) + // Create the data directory if needed + if !utils.DoesFileExists("data") { + os.Mkdir("./data", 0700) + } + // Allows a user to restore a specific database backup if *restoreDatabaseFile != "" { databaseFile := config.DatabaseFilePath