FROM golang:1.22-alpine AS builder

WORKDIR /app
COPY . .
RUN go build -ldflags="-s -w" -o tidal-proxy .

FROM alpine:3.19

RUN apk --no-cache add ca-certificates

WORKDIR /app
COPY --from=builder /app/tidal-proxy .

EXPOSE 8080

ENV PORT=:8080
ENV REQUIRED_UA_PREFIX="SpotiFLAC-Mobile/"
ENV ALLOW_ANY_QUALITY=false

CMD ["./tidal-proxy"]
