persist tailscale auth
change
commit 831358a3920252eb67b0fdc640aa59ae08989852
author Alpha Chen <alpha@kejadlen.dev>
date
parent b1870466
diff --git a/Dockerfile b/Dockerfile
index ac3cebc..de62093 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -17,5 +17,8 @@ COPY --from=docker.io/tailscale/tailscale:stable /usr/local/bin/tailscaled /app/
 COPY --from=docker.io/tailscale/tailscale:stable /usr/local/bin/tailscale /app/tailscale
 RUN mkdir -p /var/run/tailscale /var/cache/tailscale /var/lib/tailscale
 
+ENV HOME /home/nonroot
+ENV GO_JI_DB_URL sqlite:////home/nonroot/go-ji.db
+
 # Run on container startup.
 CMD ["/app/start.sh"]
diff --git a/fly.toml b/fly.toml
index 1fcd4a1..cf4b939 100644
--- a/fly.toml
+++ b/fly.toml
@@ -2,6 +2,7 @@ app = 'go-ji'
 primary_region = 'sea'
 
 [build]
+  image = 'ghcr.io/kejadlen/go-ji:latest'
 
 [http_service]
   internal_port = 8000
@@ -15,3 +16,7 @@ primary_region = 'sea'
   cpu_kind = 'shared'
   cpus = 1
   memory_mb = 256
+
+[mounts]
+  source="go-ji"
+  destination="/home/nonroot"
diff --git a/start.sh b/start.sh
index 008bd99..43cefe5 100755
--- a/start.sh
+++ b/start.sh
@@ -3,7 +3,7 @@
 /app/tailscaled --state=/var/lib/tailscale/tailscaled.state --socket=/var/run/tailscale/tailscaled.sock &
 /app/tailscale up --authkey=${TAILSCALE_AUTHKEY} --hostname=go
 
-trap '/app/tailscale logout' INT
+# trap '/app/tailscale logout' INT
 
 /app/tailscale serve --bg --http=80 8000
 gunicorn --daemon --bind 0.0.0.0:8000 go_ji:create_app