From f8e157fe9110432359e8c9d2722a7ccafbae5ab9 Mon Sep 17 00:00:00 2001 From: lyx0 <66651385+lyx0@users.noreply.github.com> Date: Tue, 19 Dec 2023 23:16:53 +0100 Subject: [PATCH] fix docker permission denied --- cmd/nourybot/download.go | 4 +++- docker-compose.yml | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cmd/nourybot/download.go b/cmd/nourybot/download.go index f3d50e7..41da886 100644 --- a/cmd/nourybot/download.go +++ b/cmd/nourybot/download.go @@ -55,7 +55,7 @@ func (app *application) ConvertAndSave(fName, link string, msg twitch.PrivateMes return } //app.Send(target, "Downloaded.", msg) - fileName := fmt.Sprintf("%s.%s", uuid_og, rExt) + fileName := fmt.Sprintf("/public/uploads/%s.%s", uuid_og, rExt) f, err := os.Create(fileName) //app.Send(target, fmt.Sprintf("Filename: %s", fileName), msg) if err != nil { @@ -86,8 +86,10 @@ func (app *application) ConvertAndSave(fName, link string, msg twitch.PrivateMes Output(out). OverWriteOutput().ErrorToStdOut().Run() + defer os.Remove(fileName) app.Send(msg.Channel, fmt.Sprintf("https://bot.noury.is/uploads/%s.mp4", fName), msg) } + func (app *application) ConvertToMP4(link string, msg twitch.PrivateMessage) { goutubedl.Path = "yt-dlp" uuid_og := uuid.NewString() diff --git a/docker-compose.yml b/docker-compose.yml index 264aa18..cd22954 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,12 +10,13 @@ services: volumes: - data:/var/lib/postgresql/data nourybot: + user: "1000:1000" build: context: . dockerfile: Dockerfile env_file: .env volumes: - - "./public/uploads:/public/uploads" + - "./public/uploads/:/public/uploads" ports: - "127.0.0.1:42069:8080" depends_on: