Add drone/dockerfile
This commit is contained in:
parent
39da857f03
commit
17293463f6
3 changed files with 58 additions and 0 deletions
33
.drone.yml
Normal file
33
.drone.yml
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
kind: pipeline
|
||||||
|
name: default
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: build
|
||||||
|
image: golang
|
||||||
|
commands:
|
||||||
|
- GOPROXY=https://modules.fromouter.space go mod download
|
||||||
|
- CGO_ENABLED=0 go install .
|
||||||
|
volumes:
|
||||||
|
- name: gopath
|
||||||
|
path: /go
|
||||||
|
|
||||||
|
- name: publish
|
||||||
|
image: plugins/docker
|
||||||
|
settings:
|
||||||
|
auto_tag: true
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
repo: hamcha/mlpcardbot
|
||||||
|
target: final
|
||||||
|
username:
|
||||||
|
from_secret: docker_username
|
||||||
|
password:
|
||||||
|
from_secret: docker_password
|
||||||
|
when:
|
||||||
|
event:
|
||||||
|
- push
|
||||||
|
- tag
|
||||||
|
branch: master
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- name: gopath
|
||||||
|
temp: {}
|
20
Dockerfile
Normal file
20
Dockerfile
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
FROM golang:alpine AS builder
|
||||||
|
|
||||||
|
ENV GOPROXY https://modules.fromouter.space
|
||||||
|
ENV GO111MODULE=on
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Get updated modules
|
||||||
|
COPY ./ ./
|
||||||
|
RUN go mod download
|
||||||
|
|
||||||
|
# Compile code
|
||||||
|
RUN CGO_ENABLED=0 go build -o /svc .
|
||||||
|
|
||||||
|
FROM scratch AS final
|
||||||
|
|
||||||
|
# Import the compiled executable from the first stage.
|
||||||
|
COPY --from=builder /svc /svc
|
||||||
|
|
||||||
|
CMD [ "/svc" ]
|
5
main.go
5
main.go
|
@ -1,8 +1,10 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"crypto/tls"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -60,6 +62,9 @@ func main() {
|
||||||
cfg.MaxRequestsPerMessage = 5
|
cfg.MaxRequestsPerMessage = 5
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ignore CA errors
|
||||||
|
http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
|
||||||
|
|
||||||
api = tg.MakeAPIClient(token)
|
api = tg.MakeAPIClient(token)
|
||||||
api.SetWebhook(webhookURL)
|
api.SetWebhook(webhookURL)
|
||||||
api.HandleWebhook(bind, webhookPath, webhook)
|
api.HandleWebhook(bind, webhookPath, webhook)
|
||||||
|
|
Loading…
Reference in a new issue