update version

This commit is contained in:
shoopea 2021-10-27 09:28:45 +08:00
parent 35542b56c0
commit 82f63fb31c
5 changed files with 60 additions and 1 deletions

40
Dockerfile Normal file
View File

@ -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/gocw2@$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/gocw2 .
# Command to run the executable
CMD ["./gocw2"]

3
generate.go Normal file
View File

@ -0,0 +1,3 @@
package main
//go:generate bash ./version.sh

View File

@ -32,7 +32,6 @@ var (
history = flag.Bool("history", false, "initialize chat history")
historyChatID64 = flag.Int64("chat_id", 0, "chat to historize")
historySenderUserID64 = flag.Int64("sender_user_id", 0, "sender_user_id to historize")
githash = "unknown"
cfg Config

5
version.go Normal file
View File

@ -0,0 +1,5 @@
// Code generated by version.sh (@generated) DO NOT EDIT.
package main
var githash = "35542b5"
var buildstamp = "2021-10-27_01:27:20"
var commits = "274"

12
version.sh Normal file
View File

@ -0,0 +1,12 @@
# Get the version.
githash=`git rev-parse --short HEAD`
buildstamp=`date -u '+%Y-%m-%d_%H:%M:%S'`
commits=`git rev-list --count master`
# Write out the package.
cat << EOF > version.go
// Code generated by version.sh (@generated) DO NOT EDIT.
package main
var githash = "$githash"
var buildstamp = "$buildstamp"
var commits = "$commits"
EOF