-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Some additional configuration * Add endpoint for alive * Change json key for alive * Add CI
- Loading branch information
Showing
8 changed files
with
111 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,14 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: gomod | ||
directory: "/" | ||
schedule: | ||
interval: daily | ||
- package-ecosystem: docker | ||
directory: "/" | ||
schedule: | ||
interval: daily | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" |
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,26 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
ci: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
go-version: ['1.18', '1.19'] | ||
os: [ubuntu-latest, macOS-latest, windows-latest] | ||
|
||
steps: | ||
- name: Set up ${{ matrix.go-version }} | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
- uses: actions/checkout@v3 | ||
- name: Build app | ||
run: |- | ||
go build -ldflags="-w -s" . |
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 |
---|---|---|
|
@@ -13,5 +13,3 @@ | |
|
||
# Dependency directories (remove the comment below to include it) | ||
# vendor/ | ||
|
||
config.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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Build Stage: Build bot using the alpine image, also install doppler in it | ||
FROM golang:1.19-alpine AS builder | ||
RUN addgroup -S gigafeeduser \ | ||
&& adduser -S -u 10000 -g gigafeeduser gigafeeduser | ||
RUN apk add -U --no-cache ca-certificates | ||
WORKDIR /app | ||
COPY . . | ||
RUN CGO_ENABLED=0 GOOS=`go env GOHOSTOS` GOARCH=`go env GOHOSTARCH` go build -o out/GIGAFeed | ||
|
||
# Run Stage: Run bot using the bot and doppler binary copied from build stage | ||
FROM scratch | ||
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt | ||
COPY --from=builder /app/out/GIGAFeed / | ||
COPY --from=builder /etc/passwd /etc/passwd | ||
USER gigafeeduser | ||
CMD ["/GIGAFeed"] |
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,14 @@ | ||
# Build Stage: Build bot using the alpine image, also install doppler in it | ||
FROM golang:1.19-alpine AS builder | ||
RUN apk add --no-cache curl wget gnupg git | ||
RUN (curl -Ls --tlsv1.2 --proto "=https" --retry 3 https://cli.doppler.com/install.sh || wget -t 3 -qO- https://cli.doppler.com/install.sh) | sh | ||
WORKDIR /app | ||
COPY . . | ||
RUN CGO_ENABLED=0 GOOS=`go env GOHOSTOS` GOARCH=`go env GOHOSTARCH` go build -o out/GIGAFeed -ldflags="-w -s" . | ||
|
||
# Run Stage: Run bot using the bot and doppler binary copied from build stage | ||
FROM gcr.io/distroless/static | ||
COPY --from=builder /app/out/GIGAFeed / | ||
COPY --from=builder /usr/local/bin/doppler / | ||
ENTRYPOINT ["/doppler", "run", "--"] | ||
CMD ["/GIGAFeed"] |
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,23 @@ | ||
package main | ||
|
||
import "os" | ||
|
||
// first the token will be read from the environment variable | ||
// if environment variable is empty, will use the constant value | ||
var BOT_TOKEN = func() string { | ||
if os.Getenv("BOT_TOKEN") == "" { | ||
// constant bot token value | ||
return "3838833:efuhuefhuefhuefheu" | ||
} | ||
return os.Getenv("BOT_TOKEN") | ||
}() | ||
|
||
// first the token will be read from the environment variable | ||
// if environment variable is empty, will use the constant value | ||
var PORT = func() string { | ||
if os.Getenv("PORT") == "" { | ||
// constant bot token value | ||
return "8080" | ||
} | ||
return os.Getenv("PORT") | ||
}() |
This file was deleted.
Oops, something went wrong.
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
a327aaa
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a test message