aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Keller <tjkeller.xyz>2025-05-23 22:12:05 -0500
committerTim Keller <tjkeller.xyz>2025-05-23 22:12:05 -0500
commit285c3e573e1d01b952342aeaf91aa09303883ebf (patch)
tree11338a9e0924bb1e18303c5f07e651ef44b4d34d
parent865911f8ffdac7d1d9773570216c0bd35fc601d9 (diff)
downloadmintube-285c3e573e1d01b952342aeaf91aa09303883ebf.tar.xz
mintube-285c3e573e1d01b952342aeaf91aa09303883ebf.zip
docker support and readme
-rw-r--r--Dockerfile28
-rw-r--r--README.md7
-rw-r--r--docker-compose.yaml9
-rw-r--r--main.go2
-rw-r--r--templates/watch.html (renamed from template.html)0
5 files changed, 45 insertions, 1 deletions
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..7e389c4
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,28 @@
+# Use an official Go image as the builder
+FROM golang:1.24-alpine AS builder
+
+WORKDIR /app
+
+# Copy go mod and sum first
+COPY go.mod go.sum ./
+RUN go mod download
+
+# Copy the source code
+COPY . .
+
+# Build the Go app
+RUN go build -o mintube .
+
+# Final lightweight image
+FROM alpine:latest
+
+WORKDIR /app
+COPY --from=builder /app/mintube .
+COPY --from=builder /app/templates ./templates
+COPY --from=builder /app/static ./static
+
+# If your app needs ports exposed (e.g., a web server)
+EXPOSE 8080
+
+# Run the Go app
+CMD ["./mintube"]
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..4775fb3
--- /dev/null
+++ b/README.md
@@ -0,0 +1,7 @@
+# MINTUBE
+A Minimal YouTube client utilizing embeds and the official YouTube API.
+
+# API KEY
+The API key is required for video details and comments.
+Generate an API key and either `export` it into your environment using
+`API_KEY=...` or, better yet, save it into a `.env` file.
diff --git a/docker-compose.yaml b/docker-compose.yaml
new file mode 100644
index 0000000..bd98f85
--- /dev/null
+++ b/docker-compose.yaml
@@ -0,0 +1,9 @@
+services:
+ mintube:
+ build: .
+ restart: always
+ ports:
+ - 7008:8080 # TOOB
+ # Add api key here, or in .env file
+ #environment:
+ # - API_KEY: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
diff --git a/main.go b/main.go
index eb56d90..160230b 100644
--- a/main.go
+++ b/main.go
@@ -12,7 +12,7 @@ import (
)
const youtubeAPI = "https://www.googleapis.com/youtube/v3/"
-var tmpl = template.Must(template.ParseFiles("template.html"))
+var tmpl = template.Must(template.ParseFiles("templates/watch.html"))
func apiRequest(w http.ResponseWriter, r *http.Request, endpoint string, videoIdParam string, part string) {
videoID := r.URL.Query().Get("id")
diff --git a/template.html b/templates/watch.html
index bae485d..bae485d 100644
--- a/template.html
+++ b/templates/watch.html