-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add docs, Dockerfile, GitHub Actions
- Loading branch information
Showing
34 changed files
with
3,882 additions
and
905 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 @@ | ||
.idea |
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,11 @@ | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
docker-build-danke: | ||
uses: ./.github/workflows/main.yml | ||
with: | ||
service_name: danke | ||
secrets: inherit |
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,35 @@ | ||
name: Production Build | ||
on: | ||
workflow_call: | ||
inputs: | ||
service_name: | ||
type: string | ||
required: true | ||
|
||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@master | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@master | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@master | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@master | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Build and push | ||
id: docker_build | ||
uses: docker/build-push-action@master | ||
with: | ||
push: true | ||
tags: | | ||
${{ secrets.DOCKERHUB_USERNAME }}/${{ inputs.service_name }}_backend:latest | ||
${{ secrets.DOCKERHUB_USERNAME }}/${{ inputs.service_name }}_backend:master |
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,31 @@ | ||
FROM golang:1.22-alpine as builder | ||
|
||
ARG SERVICE_NAME | ||
|
||
WORKDIR /app | ||
|
||
COPY go.mod go.sum ./ | ||
|
||
RUN apk add --no-cache ca-certificates tzdata && \ | ||
go mod download | ||
|
||
COPY . . | ||
|
||
RUN go build -ldflags "-s -w" -tags netgo -o backend ./$SERVICE_NAME/main.go | ||
|
||
FROM alpine | ||
|
||
WORKDIR /app | ||
|
||
COPY --from=builder /app/backend /app/ | ||
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo | ||
|
||
VOLUME ["/app/data"] | ||
|
||
ENV TZ=Asia/Shanghai | ||
ENV MODE=prod | ||
ENV LOG_LEVEL=info | ||
|
||
EXPOSE 8000 | ||
|
||
ENTRYPOINT ["./backend"] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,7 @@ | ||
package auth | ||
package main | ||
|
||
import "fmt" | ||
|
||
func main() { | ||
fmt.Println("Hello, auth!") | ||
} |
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 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,7 @@ | ||
package config | ||
|
||
import ( | ||
. "github.com/opentreehole/backend/common" | ||
"github.com/spf13/viper" | ||
_ "github.com/opentreehole/backend/common" | ||
) | ||
|
||
var defaultConfig = map[string]string{ | ||
EnvMode: "dev", | ||
EnvPort: "8000", | ||
EnvDBType: "sqlite", | ||
EnvCacheType: "memory", | ||
} | ||
|
||
func init() { | ||
for k, v := range defaultConfig { | ||
viper.SetDefault(k, v) | ||
} | ||
} | ||
// add custom config here |
Oops, something went wrong.