fix docker

This commit is contained in:
2025-10-03 02:13:29 +02:00
parent 71e16acf9a
commit d9707fb55f
5 changed files with 88 additions and 21 deletions

View File

@@ -4,13 +4,25 @@ WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN go build -ldflags="-s -w" -o spotify-ws .
RUN go build -ldflags="-s -w" -o /app/spotify-ws .
RUN go build -ldflags="-s -w" -o /app/healthcheck ./healthcheck
FROM gcr.io/distroless/static:nonroot
ARG BUILD_DATE
ARG VCS_REF
LABEL org.opencontainers.image.created=$BUILD_DATE
LABEL org.opencontainers.image.authors="skidoodle"
LABEL org.opencontainers.image.url="https://github.com/skidoodle/spotify-ws"
LABEL org.opencontainers.image.documentation="https://github.com/skidoodle/spotify-ws/blob/main/readme.md"
LABEL org.opencontainers.image.source="https://github.com/skidoodle/spotify-ws"
LABEL org.opencontainers.image.revision=$VCS_REF
LABEL org.opencontainers.image.title="spotify-ws"
LABEL org.opencontainers.image.description="A WebSocket server that relays the current Spotify playing track to connected clients."
LABEL org.opencontainers.image.licenses="AGPL-3.0"
WORKDIR /app
COPY --from=builder --chown=nonroot:nonroot /app/spotify-ws .
COPY --from=builder --chown=nonroot:nonroot /app/healthcheck .
EXPOSE 3000
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s CMD ["/spotify-ws", "-health"]
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s CMD ["/app/healthcheck"]
USER nonroot:nonroot
CMD ["/spotify-ws"]
CMD ["/app/spotify-ws"]