Skip to content

Commit

Permalink
chore: update go version, rename health to probe, update docker image…
Browse files Browse the repository at this point in the history
…, update ci.
  • Loading branch information
grantlerduck committed Aug 25, 2024
1 parent cf063c3 commit c832e31
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 18 deletions.
42 changes: 31 additions & 11 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.22.5"
go-version: "1.23.0"
- name: Install dependencies
run: make ci
- name: Vulnerability Scan
Expand All @@ -30,12 +30,12 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.22.5"
go-version: "1.23.0"
- name: Lint
uses: golangci/golangci-lint-action@v6
test:
runs-on: ubuntu-latest
needs:
needs:
- vuln-scan
- lint
steps:
Expand All @@ -44,36 +44,56 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.22.5"
go-version: "1.23.0"
- name: Install dependencies
run: make ci
- name: Run tests
run: make test_report
build:
runs-on: ubuntu-latest
needs:
- vuln-scan
- lint
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Assume build role
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ secrets.DEFAULT_AWS_TARGET_REGION }}
role-to-assume: ${{ secrets.CI_BUILD_ROLE_ARN }}
- name: Login to Amazon ECR Public Gallery
id: login-ecr-public
uses: aws-actions/amazon-ecr-login@v2
with:
registry-type: public
- name: Build Docker image
run: docker build .
synth:
runs-on: ubuntu-latest
needs:
needs:
- vuln-scan
- lint
steps:
- name: Checkout
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.22.5"
go-version: "1.23.0"
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "22.x"
- name: Assume synth role
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ secrets.DEFAULT_AWS_TARGET_REGION }}
aws-region: ${{ secrets.DEFAULT_AWS_TARGET_REGION }}
role-to-assume: ${{ secrets.CI_CDK_SYNTH_ROLE_ARN }}
- name: Setup CDK
run: npm install -g aws-cdk
- name: CDK Synth
env:
AWS_REGION: ${{ secrets.DEFAULT_AWS_TARGET_REGION }}
AWS_ACCOUNT: ${{ secrets.DEFAULT_TARGET_AWS_ACCOUNT_ID }}
run: make synth_ci
AWS_REGION: ${{ secrets.DEFAULT_AWS_TARGET_REGION }}
AWS_ACCOUNT: ${{ secrets.DEFAULT_TARGET_AWS_ACCOUNT_ID }}
run: make synth_ci
13 changes: 7 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM public.ecr.aws/docker/library/golang:1.22.4-alpine3.20 as build_base
FROM public.ecr.aws/docker/library/golang:1.23.0-alpine3.20 as build_base

ARG APP_NAME=poi-info-service
ARG APP_NAME=grpc-chagring-location-service

WORKDIR /src

Expand All @@ -13,19 +13,20 @@ RUN mkdir build
# create self signed sert for communication between app and ALB
RUN openssl req -x509 -nodes -subj "/CN=internal.service.${APP_NAME}" -newkey rsa:4096 -sha256 -keyout build/grpc-key.pem -out build/grpc-cert.pem -days 3650

# dowload dependencies
# download dependencies
RUN make ci

# build tha app
RUN go build -o build/app cmd/app/main.go
# build the app with build size optimization
RUN go build -ldflags "-s -w" -o build/app cmd/app/main.go
# build our small exetueable for our container health check
RUN go build -o build/health cmd/health/main.go
RUN go build -ldflags "-s -w" -o build/probe cmd/probe/main.go

FROM scratch

WORKDIR /service

COPY --from=build_base /src/build/ ./
COPY --from=build_base /src/boot.yaml ./
COPY --from=alpine:latest /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/

ENTRYPOINT ["/service/app"]
File renamed without changes.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/grntlrduck-cloud/go-grpc-geohasing-service-sample

go 1.22.5
go 1.23.0

require (
github.com/amazon-ion/ion-go v1.5.0
Expand Down

0 comments on commit c832e31

Please sign in to comment.