···1-FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:latest as builder
23ARG TARGETPLATFORM
4ARG BUILDPLATFORM
5ARG TARGETOS
6ARG TARGETARCH
70008# step 1. dep cache
9WORKDIR /app
10ARG TARGETPLATFORM=${BUILDPLATFORM:-linux/amd64}
···14# step 2. build the actual app
15WORKDIR /app
16COPY . .
17-RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags="-w -s" -o main ./cmd
0018ARG TARGETOS=${TARGETPLATFORM%%/*}
19ARG TARGETARCH=${TARGETPLATFORM##*/}
2021-FROM --platform=${TARGETPLATFORM:-linux/amd64} scratch
22-WORKDIR /app/
0023COPY --from=builder /app/main /app/main
024ENTRYPOINT ["/app/main"]
···1+FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.24.3-alpine3.21 as builder
23ARG TARGETPLATFORM
4ARG BUILDPLATFORM
5ARG TARGETOS
6ARG TARGETARCH
78+#needed for sqlite
9+RUN apk add --update gcc musl-dev
10+11# step 1. dep cache
12WORKDIR /app
13ARG TARGETPLATFORM=${BUILDPLATFORM:-linux/amd64}
···17# step 2. build the actual app
18WORKDIR /app
19COPY . .
20+#generate the jwks
21+RUN go run github.com/haileyok/atproto-oauth-golang/cmd/helper generate-jwks
22+RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags='-w -s -extldflags "-static"' -o main ./cmd
23ARG TARGETOS=${TARGETPLATFORM%%/*}
24ARG TARGETARCH=${TARGETPLATFORM##*/}
2526+FROM --platform=${TARGETPLATFORM:-linux/amd64} alpine:3.21
27+#Creates an empty /db folder for docker compose
28+WORKDIR /db
29+WORKDIR /app
30COPY --from=builder /app/main /app/main
31+COPY --from=builder /app/jwks.json /app/jwks.json
32ENTRYPOINT ["/app/main"]
+41-3
README.md
···910well its just a work in progress... we build in the open!
110000000000000000000000000000000000012#### development
001314assuming you have go installed and set up properly:
15···42Go types should be updated and should have the changes to the schemas
4344#### docker
0004546-TODO
47-48-
···910well its just a work in progress... we build in the open!
1112+## Setup
13+It is recommend to have port forward url while working with piper. Development or running from docker because of external callbacks.
14+15+You have a couple of options
16+1. Setup the traditional port forward on your router
17+2. Use a tool like [ngrok](https://ngrok.com/) with the command `ngrok http 8080` or [Cloudflare tunnels](https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/get-started/create-remote-tunnel/) (follow the 2a. portion of the guide when you get to that point)
18+19+Either way make note of what the publicly accessible domain name is for setting up env variables. It will be something like `https://piper.teal.fm` that you can access publicly
20+21+#### env variables
22+Copy [.env.template](.env.template) and name it [.env](.env)
23+24+This is a break down of what each env variable is and what it may look like
25+26+- `SERVER_PORT` - The port piper is hosted on
27+- `SERVER_HOST` - The server host. `localhost` is fine here, or `0.0.0.0` for docker
28+- `SERVER_ROOT_URL` - This needs to be the pubically accessible url created in [Setup](#setup). Like `https://piper.teal.fm`
29+- `SPOTIFY_CLIENT_ID` - Client Id from setup in [Spotify developer dashboard](https://developer.spotify.com/documentation/web-api/tutorials/getting-started)
30+- `SPOTIFY_CLIENT_SECRET` - Client Secret from setup in [Spotify developer dashboard](https://developer.spotify.com/documentation/web-api/tutorials/getting-started)
31+- `SPOTIFY_AUTH_URL` - most likely `https://accounts.spotify.com/authorize`
32+- `SPOTIFY_TOKEN_URL` - most likely `https://accounts.spotify.com/api/token`
33+- `SPOTIFY_SCOPES` - most likely `user-read-currently-playing user-read-email`
34+- `CALLBACK_SPOTIFY` - The first part is your publicly accessible domain. So will something like this `https://piper.teal.fm/callback/spotify`
35+36+- `ATPROTO_CLIENT_ID` - The first part is your publicly accessible domain. So will something like this `https://piper.teal.fm/.well-known/client-metadata.json`
37+- `ATPROTO_METADATA_URL` - The first part is your publicly accessible domain. So will something like this `https://piper.teal.fm/.well-known/client-metadata.json`
38+- `ATPROTO_CALLBACK_URL` - The first part is your publicly accessible domain. So will something like this `https://piper.teal.fm/callback/atproto`
39+40+- `LASTFM_API_KEY` - Your lastfm api key. Can find out how to setup [here](https://www.last.fm/api)
41+42+- `TRACKER_INTERVAL` - How long between checks to see if the registered users are listening to new music
43+- `DB_PATH`= Path for the sqlite db. If you are using the docker compose probably want `/db/piper.db` to persist data
44+45+46+47#### development
48+49+make sure you have your env setup following [the env var setup](#env-variables)
5051assuming you have go installed and set up properly:
52···79Go types should be updated and should have the changes to the schemas
8081#### docker
82+We also provide a docker compose file to use to run piper locally. There are a few edits to the [.env](.env) to make it run smoother in a container
83+`SERVER_HOST`- `0.0.0.0`
84+`DB_PATH` = `/db/piper.db` to persist your piper db through container restarts
8586+Make sure you have docker and docker compose installed, then you can run piper with `docker compose up`
00