diff --git a/Dockerfile b/Dockerfile index e18db23..b374281 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ WORKDIR /src COPY go.mod go.sum ./ RUN go mod download COPY . . -RUN CGO_ENABLED=0 go build -ldflags "-X main.version=${VERSION}" -o /levyraati . +RUN CGO_ENABLED=0 go build -ldflags "-X main.version=${VERSION}" -o /levyraati ./src FROM alpine:3.24 # yt-dlp rots against YouTube. Alpine's active branch tracks it closely (3.24 carries the current diff --git a/Makefile b/Makefile index d4c8753..322ae61 100644 --- a/Makefile +++ b/Makefile @@ -16,8 +16,10 @@ vet: test: go test ./... +# -o is required, not stylistic: the package lives in ./src, and without it `go build` would try to +# write a binary named "src" over the directory. build: - go build -o levyraati26-go . + go build -o levyraati26-go ./src # Templates and migrations are embedded, so seeing a change means rebuilding. run: build diff --git a/README.md b/README.md index 189630c..bdac664 100644 --- a/README.md +++ b/README.md @@ -82,9 +82,13 @@ in as that account and mint invites for everyone else. The two variables are rea ```sh export ADMIN_EMAIL=dev@example.com ADMIN_PASSWORD=dev SECURE_COOKIES=false -go run . +go run ./src ``` +The package lives in `src/`, together with the `templates/`, `static/` and `migrations/` it embeds — +`//go:embed` cannot reach outside its own directory, so the assets live beside the code that reads +them. `storage/` stays at the root, since it is runtime data rather than source. + Requires Go 1.27+, plus `ffmpeg`, `ffprobe`, and `yt-dlp` on `PATH`. There is nothing to start first: the database is a file under `./storage`, created on the first run. diff --git a/admin.go b/src/admin.go similarity index 100% rename from admin.go rename to src/admin.go diff --git a/auth.go b/src/auth.go similarity index 100% rename from auth.go rename to src/auth.go diff --git a/auth_test.go b/src/auth_test.go similarity index 100% rename from auth_test.go rename to src/auth_test.go diff --git a/lyrics.go b/src/lyrics.go similarity index 100% rename from lyrics.go rename to src/lyrics.go diff --git a/lyrics_test.go b/src/lyrics_test.go similarity index 100% rename from lyrics_test.go rename to src/lyrics_test.go diff --git a/main.go b/src/main.go similarity index 100% rename from main.go rename to src/main.go diff --git a/main_test.go b/src/main_test.go similarity index 100% rename from main_test.go rename to src/main_test.go diff --git a/media.go b/src/media.go similarity index 100% rename from media.go rename to src/media.go diff --git a/media_test.go b/src/media_test.go similarity index 100% rename from media_test.go rename to src/media_test.go diff --git a/migrate.go b/src/migrate.go similarity index 100% rename from migrate.go rename to src/migrate.go diff --git a/migrations/001_init.sql b/src/migrations/001_init.sql similarity index 100% rename from migrations/001_init.sql rename to src/migrations/001_init.sql diff --git a/migrations/002_users_is_admin.sql b/src/migrations/002_users_is_admin.sql similarity index 100% rename from migrations/002_users_is_admin.sql rename to src/migrations/002_users_is_admin.sql diff --git a/profile.go b/src/profile.go similarity index 100% rename from profile.go rename to src/profile.go diff --git a/ratelimit.go b/src/ratelimit.go similarity index 100% rename from ratelimit.go rename to src/ratelimit.go diff --git a/ratelimit_test.go b/src/ratelimit_test.go similarity index 100% rename from ratelimit_test.go rename to src/ratelimit_test.go diff --git a/render.go b/src/render.go similarity index 100% rename from render.go rename to src/render.go diff --git a/reports.go b/src/reports.go similarity index 100% rename from reports.go rename to src/reports.go diff --git a/reviews.go b/src/reviews.go similarity index 100% rename from reviews.go rename to src/reviews.go diff --git a/songs.go b/src/songs.go similarity index 100% rename from songs.go rename to src/songs.go diff --git a/songs_test.go b/src/songs_test.go similarity index 100% rename from songs_test.go rename to src/songs_test.go diff --git a/static/favicon.svg b/src/static/favicon.svg similarity index 100% rename from static/favicon.svg rename to src/static/favicon.svg diff --git a/static/fonts/oswald.woff2 b/src/static/fonts/oswald.woff2 similarity index 100% rename from static/fonts/oswald.woff2 rename to src/static/fonts/oswald.woff2 diff --git a/static/htmx.min.js b/src/static/htmx.min.js similarity index 100% rename from static/htmx.min.js rename to src/static/htmx.min.js diff --git a/static/lyrics.js b/src/static/lyrics.js similarity index 100% rename from static/lyrics.js rename to src/static/lyrics.js diff --git a/static/player.js b/src/static/player.js similarity index 100% rename from static/player.js rename to src/static/player.js diff --git a/static/style.css b/src/static/style.css similarity index 100% rename from static/style.css rename to src/static/style.css diff --git a/stats.go b/src/stats.go similarity index 100% rename from stats.go rename to src/stats.go diff --git a/stats_test.go b/src/stats_test.go similarity index 100% rename from stats_test.go rename to src/stats_test.go diff --git a/submit.go b/src/submit.go similarity index 100% rename from submit.go rename to src/submit.go diff --git a/submit_test.go b/src/submit_test.go similarity index 100% rename from submit_test.go rename to src/submit_test.go diff --git a/templates/admin.html b/src/templates/admin.html similarity index 100% rename from templates/admin.html rename to src/templates/admin.html diff --git a/templates/admin_reports.html b/src/templates/admin_reports.html similarity index 100% rename from templates/admin_reports.html rename to src/templates/admin_reports.html diff --git a/templates/layout.html b/src/templates/layout.html similarity index 100% rename from templates/layout.html rename to src/templates/layout.html diff --git a/templates/login.html b/src/templates/login.html similarity index 100% rename from templates/login.html rename to src/templates/login.html diff --git a/templates/partials/player.html b/src/templates/partials/player.html similarity index 100% rename from templates/partials/player.html rename to src/templates/partials/player.html diff --git a/templates/profile.html b/src/templates/profile.html similarity index 100% rename from templates/profile.html rename to src/templates/profile.html diff --git a/templates/queue.html b/src/templates/queue.html similarity index 100% rename from templates/queue.html rename to src/templates/queue.html diff --git a/templates/register.html b/src/templates/register.html similarity index 100% rename from templates/register.html rename to src/templates/register.html diff --git a/templates/report.html b/src/templates/report.html similarity index 100% rename from templates/report.html rename to src/templates/report.html diff --git a/templates/song.html b/src/templates/song.html similarity index 100% rename from templates/song.html rename to src/templates/song.html diff --git a/templates/songs.html b/src/templates/songs.html similarity index 100% rename from templates/songs.html rename to src/templates/songs.html diff --git a/templates/stats.html b/src/templates/stats.html similarity index 100% rename from templates/stats.html rename to src/templates/stats.html diff --git a/templates/submission.html b/src/templates/submission.html similarity index 100% rename from templates/submission.html rename to src/templates/submission.html diff --git a/templates/submit.html b/src/templates/submit.html similarity index 100% rename from templates/submit.html rename to src/templates/submit.html diff --git a/testdata/ytdlp-noose.json b/src/testdata/ytdlp-noose.json similarity index 100% rename from testdata/ytdlp-noose.json rename to src/testdata/ytdlp-noose.json