forked from narayana.im/telegabber
add support docker
This commit is contained in:
parent
ba8f4c08cf
commit
ffa8c72379
8 changed files with 166 additions and 5 deletions
12
Dockerfile
12
Dockerfile
|
|
@ -1,7 +1,7 @@
|
||||||
FROM golang:1.19-bookworm AS base
|
FROM golang:1.19-bookworm AS base
|
||||||
|
|
||||||
RUN apt-get update
|
RUN apt-get update
|
||||||
run apt-get install -y libssl-dev cmake build-essential gperf libz-dev make git
|
RUN apt-get install -y libssl-dev cmake build-essential gperf libz-dev make git
|
||||||
|
|
||||||
FROM base AS tdlib
|
FROM base AS tdlib
|
||||||
|
|
||||||
|
|
@ -28,9 +28,13 @@ ARG MAKEOPTS
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
RUN make ${MAKEOPTS}
|
RUN make ${MAKEOPTS}
|
||||||
|
|
||||||
FROM scratch AS telegabber
|
# Build to image
|
||||||
|
FROM debian:bookworm AS telegabber
|
||||||
|
RUN apt-get update
|
||||||
|
RUN apt-get install -y libssl-dev gperf
|
||||||
COPY --from=build /src/release/telegabber /usr/local/bin/
|
COPY --from=build /src/release/telegabber /usr/local/bin/
|
||||||
|
RUN ls -l /usr/local/bin/
|
||||||
ENTRYPOINT ["/usr/local/bin/telegabber"]
|
ENTRYPOINT ["/usr/local/bin/telegabber"]
|
||||||
|
CMD ["/usr/local/bin/telegabber", "--help"]
|
||||||
|
|
||||||
|
|
||||||
FROM scratch AS binaries
|
|
||||||
COPY --from=telegabber /usr/local/bin/telegabber /
|
|
||||||
|
|
|
||||||
2
Makefile
2
Makefile
|
|
@ -16,7 +16,7 @@ lint:
|
||||||
$(GOPATH)/bin/golint ./...
|
$(GOPATH)/bin/golint ./...
|
||||||
|
|
||||||
build_indocker:
|
build_indocker:
|
||||||
docker build --build-arg "TD_COMMIT=${TD_COMMIT}" --build-arg "VERSION=${VERSION}" --build-arg "MAKEOPTS=${MAKEOPTS}" --output=release --target binaries .
|
docker build --build-arg "TD_COMMIT=${TD_COMMIT}" --build-arg "VERSION=${VERSION}" --build-arg "MAKEOPTS=${MAKEOPTS}" -t telegabber:latest . ; docker build -f lighttpd . -t lighttpd:telegabber
|
||||||
|
|
||||||
build_indocker_staging:
|
build_indocker_staging:
|
||||||
DOCKER_BUILDKIT=1 docker build --build-arg "TD_COMMIT=${TD_COMMIT}" --build-arg "MAKEOPTS=${MAKEOPTS}" --network host --output=release --target binaries -f staging.Dockerfile .
|
DOCKER_BUILDKIT=1 docker build --build-arg "TD_COMMIT=${TD_COMMIT}" --build-arg "MAKEOPTS=${MAKEOPTS}" --network host --output=release --target binaries -f staging.Dockerfile .
|
||||||
|
|
|
||||||
24
docker/config/config.yml
Executable file
24
docker/config/config.yml
Executable file
|
|
@ -0,0 +1,24 @@
|
||||||
|
:telegram:
|
||||||
|
:loglevel: :warn
|
||||||
|
:content:
|
||||||
|
:path: '/data' # webserver workdir
|
||||||
|
:link: 'https://uploads.porno4free.ru/content' # webserver public address
|
||||||
|
:upload: 'https://uploads.porno4free.ru' # xmpp http upload address
|
||||||
|
:tdlib_verbosity: 1
|
||||||
|
:tdlib:
|
||||||
|
:datadir: '/etc/telegabber/db/sessions/'
|
||||||
|
:client:
|
||||||
|
:api_id: '11471191'
|
||||||
|
:api_hash: 'f7667171b1a8f1e2f8f2702a8a09e9d2'
|
||||||
|
:device_model: 'telegabber'
|
||||||
|
:application_version: '2.0'
|
||||||
|
:use_chat_info_database: false
|
||||||
|
:use_secret_chats: true
|
||||||
|
|
||||||
|
:xmpp:
|
||||||
|
:loglevel: :warn
|
||||||
|
:jid: 'btg.porno4free.ru'
|
||||||
|
:host: 'prosody'
|
||||||
|
:port: 5347
|
||||||
|
:password: 'YCvxuyXYQwpW3Y7IARN'
|
||||||
|
:db: '/etc/telegabber/db/dbsessions.dat'
|
||||||
104
docker/config/config_schema.json
Executable file
104
docker/config/config_schema.json
Executable file
|
|
@ -0,0 +1,104 @@
|
||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||||
|
"type": "object",
|
||||||
|
"required": [":telegram", ":xmpp"],
|
||||||
|
"properties": {
|
||||||
|
":telegram": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [":loglevel", ":content", ":tdlib"],
|
||||||
|
"properties": {
|
||||||
|
":loglevel": {
|
||||||
|
"$ref": "#/definitions/non-empty-string"
|
||||||
|
},
|
||||||
|
":content": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
":path": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
":link": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
":upload": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
":user": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
":quota": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
":tdlib_verbosity": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
":tdlib": {
|
||||||
|
"required": [":client"],
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
":datadir": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
":client": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [":api_id", ":api_hash"],
|
||||||
|
"properties": {
|
||||||
|
":api_id": {
|
||||||
|
"type": "string",
|
||||||
|
"pattern": "^[0-9]+$"
|
||||||
|
},
|
||||||
|
":api_hash": {
|
||||||
|
"$ref": "#/definitions/non-empty-string"
|
||||||
|
},
|
||||||
|
":device_model": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
":application_version": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
":use_chat_info_database": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
":use_secret_chats": {
|
||||||
|
"type": "boolean"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
":xmpp": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [":loglevel", ":jid", ":host", ":port", ":password", ":db"],
|
||||||
|
"properties": {
|
||||||
|
":loglevel": {
|
||||||
|
"$ref": "#/definitions/non-empty-string"
|
||||||
|
},
|
||||||
|
":jid": {
|
||||||
|
"$ref": "#/definitions/non-empty-string"
|
||||||
|
},
|
||||||
|
":host": {
|
||||||
|
"$ref": "#/definitions/non-empty-string"
|
||||||
|
},
|
||||||
|
":port": {
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 1
|
||||||
|
},
|
||||||
|
":password": {
|
||||||
|
"$ref": "#/definitions/non-empty-string"
|
||||||
|
},
|
||||||
|
":db": {
|
||||||
|
"$ref": "#/definitions/non-empty-string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"definitions": {
|
||||||
|
"non-empty-string": {
|
||||||
|
"type": "string",
|
||||||
|
"minLength": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
docker/data/test.jpg
Executable file
BIN
docker/data/test.jpg
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
22
docker/docker-compose.yml
Executable file
22
docker/docker-compose.yml
Executable file
|
|
@ -0,0 +1,22 @@
|
||||||
|
services:
|
||||||
|
telegabber:
|
||||||
|
image: telegabber:latest
|
||||||
|
container_name: telegabber
|
||||||
|
volumes:
|
||||||
|
- ./config:/etc/telegabber/:ro
|
||||||
|
- ./config/db:etc/telegabber/db:rw
|
||||||
|
- ./data:/data/:rw
|
||||||
|
restart: unless-stopped
|
||||||
|
entrypoint: ["/usr/local/bin/telegabber"]
|
||||||
|
command: ["-schema", "/etc/telegabber/config_schema.json", "--config", "/etc/telegabber/config.yml"]
|
||||||
|
|
||||||
|
lighttpd:
|
||||||
|
image: lighttpd:telegabber
|
||||||
|
container_name: lighttpd-telegabber
|
||||||
|
volumes:
|
||||||
|
- ./data:/data:rw
|
||||||
|
- ./config:/etc/telegabber:ro
|
||||||
|
ports:
|
||||||
|
- "80:80"
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
4
lighttpd
Normal file
4
lighttpd
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
FROM jitesoft/lighttpd
|
||||||
|
COPY lighttpd.conf /etc/lighttpd/lighttpd.conf
|
||||||
|
EXPOSE 80
|
||||||
|
CMD ["lighttpd", "-D", "-f", "/etc/lighttpd/lighttpd.conf"]
|
||||||
3
lighttpd.conf
Normal file
3
lighttpd.conf
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
server.document-root = "/data"
|
||||||
|
server.port = 80
|
||||||
|
index-file.names = ("index.html")
|
||||||
Loading…
Reference in a new issue