Merge branch 'master' into dev

This commit is contained in:
naudachu 2023-06-06 19:12:44 +05:00
commit 90d17515c3
4 changed files with 54 additions and 7 deletions

25
.github/workflows/go.yml vendored Normal file
View File

@ -0,0 +1,25 @@
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: Go
on:
push:
branches: [ "master" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19
- name: Vverify dependencies
run: go mod verify
- name: Build
run: go build -v ./cmd/main.go

17
Dockerfile Normal file
View File

@ -0,0 +1,17 @@
FROM golang:alpine as app-builder
WORKDIR $GOPATH/src/ticket-creator/
COPY . .
RUN apk add git
# Static build required so that we can safely copy the binary over.
# `-tags timetzdata` embeds zone info from the "time/tzdata" package.
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go install -ldflags '-extldflags "-static"' -tags timetzdata cmd/main.go
FROM scratch
# the test program:
COPY --from=app-builder /go/bin/main /ticket-creator
COPY --from=app-builder /go/src/ticket-creator/cmd/.env /
# the tls certificates:
# NB: this pulls directly from the upstream image, which already has ca-certificates:
COPY --from=alpine:latest /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
ENTRYPOINT ["/ticket-creator"]

View File

@ -19,7 +19,8 @@ import (
) )
func main() { func main() {
env(".env.dev") log.Print("started")
env(".env")
ctx := context.Background() ctx := context.Background()
ctx, cancel := signal.NotifyContext(ctx, os.Interrupt, os.Kill, syscall.SIGTERM) ctx, cancel := signal.NotifyContext(ctx, os.Interrupt, os.Kill, syscall.SIGTERM)

View File

@ -1,16 +1,20 @@
# Основное:
`docker build -t golang-scratch-test --pull .`
# To-do P1:
- [ ] Делать запросы в Git, ownCloud параллельно; - [ ] Делать запросы в Git, ownCloud параллельно;
- [ ] Команда для проверки работоспособности бота в проде;
- [x] Сделать бота в Telegram;
- [x] Сохранять правильную ссылку на GitBuild;
- [x] Сохранять правильную ссылку на Git; - [x] Сохранять правильную ссылку на Git;
- [x] Сохранять правильную ссылку на GitBuild;
- [x] Сделать бота в Telegram;
# Под звёздочкой: # To-do P2*:
- [ ] Сохранять короткую ссылку на графику; - [ ] Сохранять короткую ссылку на графику;
- [ ] Сохранять внешнюю ссылку на графику; - [ ] Сохранять внешнюю ссылку на графику;
- [ ] Сделать бота в Discord; - [ ] Сделать бота в Discord;
- [ ] Подумать над нормальной обработкой ошибок, сейчас достаточно всрато; - [ ] Подумать над нормальной обработкой ошибок, сейчас достаточно всрато;
- [ ] Складывать в описание репозитория ссылку на тикет; - [ ] Складывать в описание репозитория ссылку на тикет;
- [ ] Сделать базулю с достойными пользователями; - [ ] Сделать базулю с достойными пользователями;
- [x] Run bot on docker scratch: https://github.com/jeremyhuiskamp/golang-docker-scratch/blob/main/README.md