From 3a90936a167fbe86a3d6077bb1f9fab92a69b3a2 Mon Sep 17 00:00:00 2001 From: shoopea Date: Wed, 27 Oct 2021 21:42:25 +0800 Subject: [PATCH] add dockerfile and move data files --- Dockerfile | 40 ++++++++++++++++++++++++++++++++++++++++ main.go | 7 ++----- 2 files changed, 42 insertions(+), 5 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..855628e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,40 @@ +FROM golang:alpine as builder + +RUN apk add --no-cache \ + gperf \ + alpine-sdk \ + openssl-dev \ + git \ + cmake \ + zlib-dev \ + linux-headers + +WORKDIR /tmp/_build_tdlib/ + +RUN git clone https://github.com/tdlib/td.git /tmp/_build_tdlib/ + +RUN mkdir build +WORKDIR /tmp/_build_tdlib/build/ + +RUN cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr/local .. +RUN make -j13 +RUN cmake --build . --target install +RUN make install + +ARG COMMIT=latest + +WORKDIR /app/ + +RUN GOBIN=/app/ go install git.siteop.biz/chtwrs/gocw@$COMMIT + +FROM alpine:latest + +RUN apk add --no-cache \ + libstdc++ + +WORKDIR /app/ + +# Copy the Pre-built binary file from the previous stage +COPY --from=builder /app/gocw . +# Command to run the executable +CMD ["./gocw"] diff --git a/main.go b/main.go index 4e88a0d..7dd66c0 100644 --- a/main.go +++ b/main.go @@ -13,9 +13,6 @@ import ( "time" "github.com/Arman92/go-tdlib" - // "github.com/go-web/tokenizer" - // "database/sql" - // _ "github.com/go-sql-driver/mysql" ) type ChatWarsWithdraw struct { @@ -68,8 +65,8 @@ func main() { UseFileDatabase: true, UseChatInfoDatabase: true, UseTestDataCenter: false, - DatabaseDirectory: "./tdlib-db", - FileDirectory: "./tdlib-files", + DatabaseDirectory: "./data/tdlib-db", + FileDirectory: "./data/tdlib-files", IgnoreFileNames: false, })