-
Notifications
You must be signed in to change notification settings - Fork 1
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 #102 from YukiOnishi1129/feature/fix-cloud-build
Feature/fix cloud build
- Loading branch information
Showing
4 changed files
with
50 additions
and
68 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,24 @@ | ||
FROM golang:1.22-alpine3.18 AS go-builder | ||
|
||
RUN apk update && apk add git | ||
|
||
WORKDIR /app | ||
|
||
COPY ./batch-service/go.mod ./ | ||
COPY ./batch-service/go.sum ./ | ||
COPY ./batch-service/cmd/trend-article-crawler ./cmd/trend-article-crawler | ||
COPY ./batch-service/database/init_db.go ./database/init_db.go | ||
COPY ./batch-service/domain ./domain | ||
COPY ./batch-service/entity ./entity | ||
COPY ./batch-service/infrastructure/api ./infrastructure/api | ||
COPY ./batch-service/infrastructure/rss ./infrastructure/rss | ||
COPY ./batch-service/internal ./internal | ||
|
||
RUN go mod download \ | ||
&& go build -o main /app/cmd/trend-article-crawler/main.go | ||
|
||
FROM alpine:3.18 | ||
WORKDIR /app | ||
COPY --from=go-builder /app/main . | ||
|
||
CMD ["/app/main"] |
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 @@ | ||
# staging environment | ||
substitutions: | ||
_IMAGE: 'trend-article-crawler/latest' | ||
_JOB_NAME: 'trend-article-crawler' | ||
steps: | ||
# Build the container image | ||
- name: 'gcr.io/cloud-builders/docker' | ||
args: ['build', '-t', '$_REGION-docker.pkg.dev/$PROJECT_ID/$_IMAGE','-f', 'batch-service/Dockerfile.trend-article-crawler', '.'] | ||
# Push the container image to Container Registry | ||
- name: 'gcr.io/cloud-builders/docker' | ||
args: ['push', '$_REGION-docker.pkg.dev/$PROJECT_ID/$_IMAGE'] | ||
# Deploy container image to Cloud Run Jobs | ||
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk' | ||
entrypoint: gcloud | ||
args: | ||
- 'run' | ||
- 'jobs' | ||
- 'deploy' | ||
- '$_JOB_NAME' | ||
- '--image' | ||
- '$_REGION-docker.pkg.dev/$PROJECT_ID/$_IMAGE' | ||
- '--region' | ||
- '$_REGION' | ||
# - '--execute-now' | ||
images: | ||
- $_REGION-docker.pkg.dev/$PROJECT_ID/$_IMAGE |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.