-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from codescalers/create-dockerfile-and-makefile
Create dockerfile and makefile
- Loading branch information
Showing
6 changed files
with
152 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Lint | ||
|
||
on: | ||
push: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
Lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install GO | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.21 | ||
|
||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
args: --timeout 3m --verbose | ||
|
||
- name: staticcheck | ||
uses: dominikh/[email protected] | ||
with: | ||
version: "2022.1.3" | ||
|
||
- name: gofmt | ||
uses: Jerome1337/[email protected] | ||
with: | ||
gofmt-flags: "-l -d" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
FROM golang:1.21-alpine as builder | ||
|
||
WORKDIR /src | ||
|
||
COPY . . | ||
|
||
RUN go mod tidy | ||
|
||
RUN go build -o statusbot main.go | ||
|
||
|
||
FROM alpine | ||
|
||
WORKDIR /app | ||
|
||
COPY --from=builder /src/statusbot . | ||
|
||
CMD ./statusbot -t ${STATUSBOT_TOKEN} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
GOPATH := $(shell go env GOPATH) | ||
|
||
getverifiers: | ||
@echo "Installing staticcheck" && go get -u honnef.co/go/tools/cmd/staticcheck && go install honnef.co/go/tools/cmd/staticcheck | ||
@echo "Installing gocyclo" && go get -u github.com/fzipp/gocyclo/cmd/gocyclo && go install github.com/fzipp/gocyclo/cmd/gocyclo | ||
@echo "Installing deadcode" && go get -u github.com/remyoudompheng/go-misc/deadcode && go install github.com/remyoudompheng/go-misc/deadcode | ||
@echo "Installing misspell" && go get -u github.com/client9/misspell/cmd/misspell && go install github.com/client9/misspell/cmd/misspell | ||
@echo "Installing golangci-lint" && go install github.com/golangci/golangci-lint/cmd/[email protected] | ||
go mod tidy | ||
|
||
verifiers: fmt lint cyclo deadcode spelling staticcheck | ||
|
||
fmt: | ||
@echo "Running $@" | ||
@gofmt -d . | ||
|
||
lint: | ||
@echo "Running $@" | ||
@${GOPATH}/bin/golangci-lint run | ||
|
||
cyclo: | ||
@echo "Running $@" | ||
@${GOPATH}/bin/gocyclo -over 100 . | ||
|
||
deadcode: | ||
@echo "Running $@" | ||
@${GOPATH}/bin/deadcode -test $(shell go list ./...) || true | ||
|
||
spelling: | ||
@echo "Running $@" | ||
@${GOPATH}/bin/misspell -i monitord -error `find .` | ||
|
||
staticcheck: | ||
@echo "Running $@" | ||
@${GOPATH}/bin/staticcheck -- ./... | ||
|
||
build: | ||
@echo "Running $@" | ||
@go build -o statusbot main.go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,60 @@ | ||
# statusbot | ||
# Statusbot | ||
|
||
## Overview | ||
|
||
The Status Bot is a tool designed to send a reminder at 5 O'clock | ||
|
||
## Getting Started | ||
|
||
### Prerequisites | ||
|
||
Ensure that you have installed: | ||
|
||
- Go programming language (version 1.21 or higher if not using docker) | ||
- Git | ||
|
||
### How to start | ||
|
||
1. Clone this repository to your local machine: | ||
|
||
```bash | ||
git clone https://github.com/codescalers/statusbot | ||
cd statusbot | ||
``` | ||
|
||
2. Setup your telegram bot and your env | ||
|
||
- Create a new [telegram bot](README.md#create-a-bot) if you don't have. | ||
|
||
3. Run the bot: | ||
|
||
- Using go | ||
|
||
```bash | ||
go run main.go -t <your bot token> | ||
``` | ||
|
||
- Using Docker | ||
|
||
```bash | ||
docker build -t statusbot . | ||
docker run -e <your bot token> -it statusbot | ||
``` | ||
|
||
## Create a bot | ||
|
||
- Open telegram app | ||
- Create a new bot | ||
|
||
```ordered | ||
1. Find telegram bot named "@botfarther" | ||
2. Type /newbot | ||
``` | ||
|
||
- Get the bot token | ||
|
||
```ordered | ||
1. In the same bot named "@botfarther" | ||
2. Type /token | ||
3. Choose your bot | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters