docker-compose setup

This commit is contained in:
DataHoarder 2023-04-22 10:53:47 +02:00
parent 9f16c2b43d
commit 69d2c980ac
Signed by: DataHoarder
SSH key fingerprint: SHA256:OLTRf6Fl87G52SiR7sWLGNzlJt4WOX+tfI2yxo0z7xk
5 changed files with 86 additions and 1 deletions

6
.dockerignore Normal file
View file

@ -0,0 +1,6 @@
.git/
.env
.env.example
.gitignore
docker-compose.override.yml
README.md

21
.env.example Normal file
View file

@ -0,0 +1,21 @@
#GOPROXY=direct
# IRC host/port to connect to
IRC_HOST=irc.libera.chat
IRC_PORT=6697
# Bot configuration
BOT_NICK=
BOT_USER=
# ChanServ password
BOT_PASSWORD=
# A list of #CHANNEL,NAME,API_ENDPOINT separated by; for example: #p2pool-main,Main,https://p2pool.observer;#p2pool-mini,Mini,https://mini.p2pool.observer
CHANNELS=
# Pleroma host and cookie if any
PLEROMA_HOST=
PLEROMA_COOKIE=
# Extra command line arguments like SSL
EXTRA_ARGS=-irc-ssl

4
.gitignore vendored
View file

@ -1 +1,3 @@
.idea
.idea
.env.example
docker-compose.override.yml

23
Dockerfile Normal file
View file

@ -0,0 +1,23 @@
FROM golang:1.20-alpine
ENV CFLAGS="-march=native -Ofast"
ENV CXXFLAGS="-march=native -Ofast"
ENV LDFLAGS="-flto"
ENV CGO_CFLAGS="-march=native -Ofast"
ENV CGO_ENABLED="0"
WORKDIR /usr/src/p2pool-observer-bot
ARG GOPROXY=""
ENV GOPROXY=${GOPROXY}
COPY go.mod go.sum ./
RUN go mod download -x && go mod verify
COPY . .
RUN go build -buildvcs=false -trimpath -v -o /usr/bin/bot git.gammaspectra.live/P2Pool/p2pool-observer-bot
WORKDIR /data

33
docker-compose.yml Normal file
View file

@ -0,0 +1,33 @@
version: "2.2"
networks:
p2pool-observer-bot:
external: false
volumes:
data:
external: false
services:
bot:
build:
context: ./
dockerfile: ./Dockerfile
args:
- GOPROXY=${GOPROXY}
restart: always
environment:
- BOT_PASSWORD=${BOT_PASSWORD}
- PLEROMA_COOKIE=${PLEROMA_COOKIE}
security_opt:
- no-new-privileges:true
networks:
- p2pool-observer-bot
command: >-
/usr/bin/bot
-irc-host "${IRC_HOST}"
-irc-port "${IRC_PORT}"
-bot-nick "${BOT_NICK}"
-bot-user "${BOT_USER}"
-pleroma-host "${PLEROMA_HOST}"
-channels "${CHANNELS}"
${P2POOL_EXTRA_ARGS}