twitch-bot/Dockerfile
2025-04-06 21:25:22 +00:00

55 lines
1.5 KiB
Docker

FROM golang:1.24-alpine@sha256:7772cb5322baa875edd74705556d08f0eeca7b9c4b5367754ce3f2f00041ccee AS builder
COPY . /go/src/twitch-bot
WORKDIR /go/src/twitch-bot
ENV CGO_ENABLED=0 \
GOPATH=/go
RUN set -ex \
&& apk --no-cache add \
curl \
git \
make \
nodejs \
npm \
&& git config --global --add safe.directory /go/src/twitch-bot \
&& make node_modules frontend_prod \
&& go install \
-trimpath \
-mod=readonly \
-modcacherw \
-ldflags "-X main.version=$(git describe --tags --always || echo dev)"
FROM alpine:3.21@sha256:a8560b36e8b8210634f77d9f7f9efd7ffa463e380b75e2e74aff4511df3ef88c
LABEL org.opencontainers.image.authors="Knut Ahlers <knut@ahlers.me>" \
org.opencontainers.image.url="https://github.com/users/Luzifer/packages/container/package/twitch-bot" \
org.opencontainers.image.documentation="https://luzifer.github.io/twitch-bot/" \
org.opencontainers.image.source="https://github.com/Luzifer/twitch-bot" \
org.opencontainers.image.licenses="Apache-2.0" \
org.opencontainers.image.title="Self-hosted alternative to one of the big Twitch bots managed by big companies"
ENV CONFIG=/data/config.yaml \
STORAGE_CONN_STRING=/data/store.db
RUN set -ex \
&& apk --no-cache add \
bash \
ca-certificates \
curl \
jq \
tzdata \
&& mkdir /data \
&& chown 1000:1000 /data
COPY --from=builder /go/bin/twitch-bot /usr/local/bin/twitch-bot
USER 1000:1000
VOLUME ["/data"]
ENTRYPOINT ["/usr/local/bin/twitch-bot"]
CMD ["--"]
# vim: set ft=Dockerfile: