try to implement docker
This commit is contained in:
1 parent
94adeb2b69
commit
87baf8c8e8
5 files changed
+135
No files matched your search
@@ -0,0 +1,42 @@
|
|||||||
|
name: Build & push bot Docker image
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-push:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- uses: docker/metadata-action@v5
|
||||||
|
id: meta
|
||||||
|
with:
|
||||||
|
images: ghcr.io/${{ github.repository_owner }}/whitelist-bypass-bot
|
||||||
|
tags: |
|
||||||
|
type=ref,event=tag
|
||||||
|
type=raw,value=latest,enable=${{ github.event_name != 'workflow_dispatch' }}
|
||||||
|
|
||||||
|
- uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: headless/docker/Dockerfile
|
||||||
|
push: true
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# VK community access token (required). Settings -> API usage -> Access tokens.
|
||||||
|
VK_TOKEN=vk1.a.your-community-access-token
|
||||||
|
|
||||||
|
# VK community ID, digits only (required).
|
||||||
|
VK_GROUP_ID=123456789
|
||||||
|
|
||||||
|
# Comma-separated VK user IDs allowed to issue commands. Empty = anyone.
|
||||||
|
VK_USER_IDS=
|
||||||
|
|
||||||
|
# Resource mode passed to spawned creators: default | moderate | unlimited.
|
||||||
|
RESOURCES=default
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
FROM golang:1.26-bookworm AS build
|
||||||
|
ENV CGO_ENABLED=0
|
||||||
|
WORKDIR /src
|
||||||
|
|
||||||
|
COPY relay /src/relay
|
||||||
|
COPY headless /src/headless
|
||||||
|
|
||||||
|
RUN go -C /src/headless/vk build -trimpath -ldflags="-s -w" -o /out/headless-vk-creator . \
|
||||||
|
&& go -C /src/headless/telemost build -trimpath -ldflags="-s -w" -o /out/headless-telemost-creator . \
|
||||||
|
&& go -C /src/headless/wbstream build -trimpath -ldflags="-s -w" -o /out/headless-wbstream-creator . \
|
||||||
|
&& go -C /src/headless/vk-bot build -trimpath -ldflags="-s -w" -o /out/headless-vk-bot .
|
||||||
|
|
||||||
|
FROM debian:bookworm-slim
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y --no-install-recommends ca-certificates tini \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
RUN useradd --system --create-home --home /home/wlb --shell /usr/sbin/nologin wlb \
|
||||||
|
&& mkdir -p /opt/wlb/bin /data/sessions \
|
||||||
|
&& chown -R wlb:wlb /data
|
||||||
|
|
||||||
|
COPY --from=build /out/headless-vk-creator /opt/wlb/bin/
|
||||||
|
COPY --from=build /out/headless-telemost-creator /opt/wlb/bin/
|
||||||
|
COPY --from=build /out/headless-wbstream-creator /opt/wlb/bin/
|
||||||
|
COPY --from=build /out/headless-vk-bot /usr/local/bin/
|
||||||
|
|
||||||
|
COPY headless/docker/entrypoint.sh /usr/local/bin/wlb-entrypoint
|
||||||
|
RUN chmod +x /usr/local/bin/wlb-entrypoint
|
||||||
|
|
||||||
|
USER wlb
|
||||||
|
WORKDIR /data
|
||||||
|
VOLUME ["/data"]
|
||||||
|
|
||||||
|
ENTRYPOINT ["/usr/bin/tini", "--", "/usr/local/bin/wlb-entrypoint"]
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
services:
|
||||||
|
bot:
|
||||||
|
image: ghcr.io/kulikov0/whitelist-bypass-bot:latest
|
||||||
|
container_name: whitelist-bypass-bot
|
||||||
|
restart: unless-stopped
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
volumes:
|
||||||
|
# Cookies for spawned creators. Create empty `[]` files for platforms you
|
||||||
|
# don't use, or remove the corresponding line.
|
||||||
|
- ./cookies-vk.json:/data/cookies-vk.json:ro
|
||||||
|
- ./cookies-telemost.json:/data/cookies-telemost.json:ro
|
||||||
|
# Per-session creator logs persist here.
|
||||||
|
- bot-sessions:/data/sessions
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
bot-sessions:
|
||||||
Executable
+31
@@ -0,0 +1,31 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
: "${VK_TOKEN:?VK_TOKEN is required}"
|
||||||
|
: "${VK_GROUP_ID:?VK_GROUP_ID is required}"
|
||||||
|
|
||||||
|
BINS_DIR="${BINS_DIR:-/opt/wlb/bin}"
|
||||||
|
SESSIONS_DIR="${SESSIONS_DIR:-/data/sessions}"
|
||||||
|
RESOURCES="${RESOURCES:-default}"
|
||||||
|
|
||||||
|
VK_COOKIES_DEFAULT="/data/cookies-vk.json"
|
||||||
|
TM_COOKIES_DEFAULT="/data/cookies-telemost.json"
|
||||||
|
VK_COOKIES="${VK_COOKIES:-}"
|
||||||
|
TM_COOKIES="${TM_COOKIES:-}"
|
||||||
|
[ -z "$VK_COOKIES" ] && [ -f "$VK_COOKIES_DEFAULT" ] && VK_COOKIES="$VK_COOKIES_DEFAULT"
|
||||||
|
[ -z "$TM_COOKIES" ] && [ -f "$TM_COOKIES_DEFAULT" ] && TM_COOKIES="$TM_COOKIES_DEFAULT"
|
||||||
|
|
||||||
|
mkdir -p "$SESSIONS_DIR"
|
||||||
|
|
||||||
|
set -- \
|
||||||
|
--token "$VK_TOKEN" \
|
||||||
|
--group-id "$VK_GROUP_ID" \
|
||||||
|
--bins-dir "$BINS_DIR" \
|
||||||
|
--sessions-dir "$SESSIONS_DIR" \
|
||||||
|
--resources "$RESOURCES"
|
||||||
|
|
||||||
|
[ -n "${VK_USER_IDS:-}" ] && set -- "$@" --user-id "$VK_USER_IDS"
|
||||||
|
[ -n "$VK_COOKIES" ] && set -- "$@" --vk-cookies "$VK_COOKIES"
|
||||||
|
[ -n "$TM_COOKIES" ] && set -- "$@" --tm-cookies "$TM_COOKIES"
|
||||||
|
|
||||||
|
exec /usr/local/bin/headless-vk-bot "$@"
|
||||||
Reference in new issue
Block a user