Compare commits

..

No commits in common. "8226e179ab133da96a5327360c28af15afe28b5b" and "d72993368ef61821d18bccee3cc78c9bf3d7b3d8" have entirely different histories.

6 changed files with 35 additions and 49 deletions

2
.gitignore vendored
View File

@ -2,5 +2,5 @@
go.sum
account/
gen_result/
etc/service.yaml
etc/app-cloudep-notification-service.yaml
./client

View File

@ -1,5 +1,6 @@
GO_CTL_NAME=goctl
# go-zero 生成風格
GO_ZERO_STYLE=go_zero
@ -7,8 +8,6 @@ GO ?= go
GOFMT ?= gofmt "-s"
GOFILES := $(shell find . -name "*.go")
LDFLAGS := -s -w
VERSION="v1.0.3"
DOCKER_REPO="igs170911/notification"
.PHONY: test
test: # 進行測試
@ -36,14 +35,3 @@ gen-clean: # 建立 rpc code
rm -rf go.sum
rm -rf service.go
@echo "Generate core-api files successfully"
.PHONY: run-docker
run-docker: # 建立 rpc code
docker run --platform=linux/arm64/v8 -p 8080:8080 $(DOCKER_REPO):$(VERSION)
.PHONY: build-docker
build-docker:
cp ./build/Dockerfile Dockerfile
docker buildx build -t $(DOCKER_REPO):$(VERSION) --build-arg SSH_PRIVATE_KEY="$(cat ~/.ssh/ed_25519)" .
rm -rf Dockerfile
@echo "Generate core-api files successfully"

View File

@ -2,46 +2,46 @@
# BUILDER #
###########
FROM golang:1.22.3 as builder
FROM golang:1.20 as builder
ARG VERSION
ARG BUILT
ARG GIT_COMMIT
ARG SSH_PRV_KEY
# private go packages
ENV GOPRIVATE=code.30cm.net
ENV FLAG="-s -w -X main.Version=${VERSION} -X main.Built=${BUILT} -X main.GitCommit=${GIT_COMMIT}"
WORKDIR /app
COPY . .
RUN apt-get update && \
apt-get install git
# Make the root foler for our ssh
RUN mkdir -p /root/.ssh && \
chmod 0700 /root/.ssh && \
ssh-keyscan git.30cm.net > /root/.ssh/known_hosts && \
echo "$SSH_PRV_KEY" > /root/.ssh/id_rsa && \
chmod 600 /root/.ssh/id_rsa
WORKDIR /app
COPY . .
# Download public key for yt.com
RUN mkdir -p -m 0700 ~/.ssh && ssh-keyscan yt.com >> ~/.ssh/known_hosts
# Forces the usage of git and ssh key fwded by ssh-agent for yt.com git repos
RUN git config --global url."git@yt.com:".insteadOf "https://yt.com"
# private go packages
ENV GOPRIVATE=yt.com
RUN --mount=type=ssh go mod download
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \
-ldflags "$FLAG" \
-o service
ENV FLAG="-s -w -X main.Version=${VERSION} -X main.Built=${BUILT} -X main.GitCommit=${GIT_COMMIT}"
RUN CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build \
-ldflags "$FLAG" \
-o /permission-server ./cmd/permission
#########
# FINAL #
#########
FROM oraclelinux:9-slim AS final
##########
## FINAL #
##########
#
FROM gcr.io/distroless/static-debian11
WORKDIR /app
COPY --from=builder /app/service /app/service
COPY --from=builder /app/etc/service.yaml /app/etc/service.yaml
EXPOSE 8080
CMD ["/app/service"]
COPY --from=builder /permission-server /app/permission-server
COPY --from=builder /app/configs/config-example.yaml /app/config.yaml
COPY --from=builder /app/configs/rbac_model.conf /app/rbac_model.conf
CMD ["/app/permission-server"]

1
go.mod
View File

@ -3,7 +3,6 @@ module app-cloudep-notification-service
go 1.22.3
require (
code.30cm.net/digimon/library-go/errors v1.0.0
github.com/zeromicro/go-zero v1.7.0
google.golang.org/grpc v1.65.0
google.golang.org/protobuf v1.34.2

View File

@ -1,11 +1,11 @@
package senderservicelogic
import (
"context"
"app-cloudep-notification-service/gen_result/pb/notification"
"app-cloudep-notification-service/internal/svc"
ers "code.30cm.net/digimon/library-go/errors"
"context"
"fmt"
"github.com/zeromicro/go-zero/core/logx"
)
@ -23,9 +23,9 @@ func NewSendMailByTemplateIdLogic(ctx context.Context, svcCtx *svc.ServiceContex
}
}
// SendMailByTemplateId 寄送模板信件
// SendMailByTemplateID 寄送模板信件
func (l *SendMailByTemplateIdLogic) SendMailByTemplateId(in *notification.SendByTemplateIDReq) (*notification.OKResp, error) {
fmt.Println(ers.ResourceNotFound("testing"))
// todo: add your logic here and delete this line
return &notification.OKResp{}, nil
}

View File

@ -7,7 +7,6 @@ import (
"context"
"app-cloudep-notification-service/gen_result/pb/notification"
senderservicelogic "app-cloudep-notification-service/internal/logic/senderservice"
"app-cloudep-notification-service/internal/logic/senderservice"
"app-cloudep-notification-service/internal/svc"
)