Skip to content

Commit

Permalink
Merge branch 'ci/backend' of github.com:GreenTeaProgrammers/WhereChil…
Browse files Browse the repository at this point in the history
…dBus into ci/backend
  • Loading branch information
lovelovetrb committed Feb 19, 2024
2 parents db3d904 + 6536ca1 commit c9ac239
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 13 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/deploy-to-gcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ permissions:
on:
push:
branches:
- ci/backend # デプロイをトリガーするブランチを指定
- develop
paths:
- "backend/**"

jobs:
setup-build-deploy:
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/deploy_cloudrun_machine_learning.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches:
- develop
- feature/machine-learning/cicd
paths:
- "machine-learning/**"

Expand Down
10 changes: 0 additions & 10 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ ARG ML_ADDR

ARG INSIDE_OF_CREDENTIALS

RUN echo "Port is: $PORT" && echo "Mode is: $MODE_DEV"


# .env ファイルを生成
RUN echo "DSN=$DSN" > .env \
&& echo "DB_USER_NAME=$DB_USER_NAME" >> .env \
Expand Down Expand Up @@ -70,12 +67,5 @@ COPY --from=builder /srv/grpc/.env /app/.env
# secretsディレクトリを/appディレクトリにコピー
COPY --from=builder /srv/grpc/secrets /app/secrets

RUN ls -la /app/secrets
RUN echo "gcp-credentials.json is: $(cat /app/secrets/gcp-credentials.json)"

# /appディレクトリ以下の全てのサブファイルディレクトリも含めた構造を出力
RUN ls -laR /app
ENV GOOGLE_APPLICATION_CREDENTIALS=/app/secrets/gcp-credentials.json

# アプリケーションの起動
ENTRYPOINT ["/app/server"]
4 changes: 3 additions & 1 deletion backend/cmd/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
mlv1 "github.com/GreenTeaProgrammers/WhereChildBus/backend/proto-gen/go/machine_learning/v1"
"github.com/go-sql-driver/mysql"
_ "github.com/go-sql-driver/mysql"
"google.golang.org/api/option"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"

Expand Down Expand Up @@ -73,7 +74,8 @@ func main() {
// Cloud Storageへの接続を開始
log.Println("Connecting to Cloud Storage...")
ctx := context.Background()
storageClient, err := storage.NewClient(ctx)
credPath := "./secrets/gcp-credentials.json"
storageClient, err := storage.NewClient(ctx, option.WithCredentialsFile(credPath))
if err != nil {
log.Fatalf("Failed to create Cloud Storage client: %v", err)
}
Expand Down

0 comments on commit c9ac239

Please sign in to comment.