-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuildspec.yml
More file actions
31 lines (29 loc) · 1 KB
/
buildspec.yml
File metadata and controls
31 lines (29 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
version: 0.2
phases:
install:
runtime-versions:
golang: 1.24
pre_build:
commands:
- echo Installing dependencies...
- go mod download
- export IMAGE_TAG=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7)
- echo "Image tag set to $IMAGE_TAG"
build:
commands:
- echo Build started on `date`
- GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -tags jsoniter -ldflags="-s -w" -p 8 -o cmd/cmd cmd/main.go
on-failure: ABORT
post_build:
commands:
- echo Build completed on `date`
# Parallel upload to S3
- |
aws s3 cp cmd/cmd s3://prod-dotzero-project-builds/${SERVICE_NAME}/executables/${IMAGE_TAG}/cmd &
aws s3 cp configs/prod/config.json s3://prod-dotzero-project-builds/${SERVICE_NAME}/executables/${IMAGE_TAG}/config.json &
wait
echo "${IMAGE_TAG}" | aws s3 cp - s3://prod-dotzero-project-builds/${SERVICE_NAME}/latest.txt
cache:
key: go-$(codebuild-hash-files go.sum)
paths:
- "/go/pkg/mod/**/*"