Skip to content

Commit bd01285

Browse files
authored
Rework AL2 dockerfiles (#967) (#972)
- Rework dockerfiles for cleaner build - Update Makefile targets
1 parent 7001d86 commit bd01285

27 files changed

+398
-496
lines changed

Makefile

Lines changed: 67 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -26,31 +26,23 @@ FLB_REPOSITORY ?= "https://github.com/amazon-contributing/upstream-to-fluent-bit
2626
dev: DOCKER_BUILD_FLAGS =
2727
dev: release
2828

29-
.PHONY: release
30-
release: build build-init linux-plugins
31-
docker system prune -f
32-
docker build $(DOCKER_BUILD_FLAGS) --build-arg AL_TAG=${AL_TAG} -t amazon/aws-for-fluent-bit:main-release -f ./scripts/dockerfiles/Dockerfile.main-release .
33-
docker tag amazon/aws-for-fluent-bit:main-release amazon/aws-for-fluent-bit:latest
34-
docker system prune -f
35-
docker build $(DOCKER_BUILD_FLAGS) -t amazon/aws-for-fluent-bit:init-latest -f ./scripts/dockerfiles/Dockerfile.init-release .
36-
37-
.PHONY: debug
38-
debug: main-debug init-debug
29+
.PHONY: build-common
30+
build-common:
31+
docker build $(DOCKER_BUILD_FLAGS) -t amazon/aws-for-fluent-bit:build-deps-al${AL_TAG} -f ./scripts/dockerfiles/build/Dockerfile.deps-al${AL_TAG} .
32+
docker build $(DOCKER_BUILD_FLAGS) --build-arg AL_TAG=${AL_TAG} --build-arg FLB_VERSION=${FLB_VERSION} --build-arg FLB_REPOSITORY=${FLB_REPOSITORY} -t amazon/aws-for-fluent-bit:build-common-al${AL_TAG} -f ./scripts/dockerfiles/build/Dockerfile.build-common .
33+
docker build $(DOCKER_BUILD_FLAGS) -t amazon/aws-for-fluent-bit:golang -f ./scripts/dockerfiles/build/Dockerfile.golang .
34+
docker build $(DOCKER_BUILD_FLAGS) -t amazon/aws-for-fluent-bit:compile-init-al${AL_TAG} -f ./scripts/dockerfiles/build/Dockerfile.compile-init .
3935

4036
.PHONY: build
41-
build:
42-
docker system prune -f
43-
docker build $(DOCKER_BUILD_FLAGS) --build-arg AL_TAG=${AL_TAG} --build-arg FLB_VERSION=${FLB_VERSION} --build-arg FLB_REPOSITORY=${FLB_REPOSITORY} -t amazon/aws-for-fluent-bit:build -f ./scripts/dockerfiles/Dockerfile.build .
37+
build: build-common
38+
docker build $(DOCKER_BUILD_FLAGS) --build-arg BUILD_IMAGE=amazon/aws-for-fluent-bit:build-common-al${AL_TAG} -t amazon/aws-for-fluent-bit:compile-al${AL_TAG} -f ./scripts/dockerfiles/build/Dockerfile.compile .
4439

45-
.PHONY: build-init
46-
build-init:
47-
docker build $(DOCKER_BUILD_FLAGS) --build-arg AL_TAG=${AL_TAG} -t amazon/aws-for-fluent-bit:build-init -f ./scripts/dockerfiles/Dockerfile.build-init .
48-
49-
#TODO: the bash script opts does not work on developer Macs
50-
windows-plugins: export OS_TYPE = windows
51-
linux-plugins: export OS_TYPE = linux
40+
.PHONY: build-debug
41+
build-debug: build-common
42+
docker build $(DOCKER_BUILD_FLAGS) --build-arg BUILD_IMAGE=amazon/aws-for-fluent-bit:build-common-al${AL_TAG} --build-arg DEBUG=On --build-arg RELEASE=Off -t amazon/aws-for-fluent-bit:compile-debug-al${AL_TAG} -f ./scripts/dockerfiles/build/Dockerfile.compile .
5243

5344
.PHONY: windows-plugins
45+
windows-plugins: export OS_TYPE = windows
5446
windows-plugins:
5547
./scripts/build_plugins.sh \
5648
--KINESIS_PLUGIN_CLONE_URL=${KINESIS_PLUGIN_CLONE_URL} \
@@ -65,6 +57,7 @@ windows-plugins:
6557
--DOCKER_BUILD_FLAGS=${DOCKER_BUILD_FLAGS}
6658

6759
.PHONY: linux-plugins
60+
linux-plugins: export OS_TYPE = linux
6861
linux-plugins:
6962
./scripts/build_plugins.sh \
7063
--KINESIS_PLUGIN_CLONE_URL=${KINESIS_PLUGIN_CLONE_URL} \
@@ -78,88 +71,64 @@ linux-plugins:
7871
--CLOUDWATCH_PLUGIN_BRANCH=${CLOUDWATCH_PLUGIN_BRANCH} \
7972
--DOCKER_BUILD_FLAGS=${DOCKER_BUILD_FLAGS}
8073

81-
# Debug and debug init images
82-
.PHONY: main-debug
83-
main-debug: debug-s3
84-
docker tag amazon/aws-for-fluent-bit:debug-s3 amazon/aws-for-fluent-bit:debug
74+
.PHONY: release
75+
release: build linux-plugins
76+
docker build $(DOCKER_BUILD_FLAGS) -t amazon/aws-for-fluent-bit:runtime-deps-al${AL_TAG} -f ./scripts/dockerfiles/runtime/Dockerfile.deps-al${AL_TAG} .
77+
docker build $(DOCKER_BUILD_FLAGS) --build-arg COMPILE_IMAGE=amazon/aws-for-fluent-bit:compile-al${AL_TAG} --build-arg RUNTIME_IMAGE=amazon/aws-for-fluent-bit:runtime-deps-al${AL_TAG} -t amazon/aws-for-fluent-bit:latest-al${AL_TAG} -f ./scripts/dockerfiles/runtime/Dockerfile .
78+
docker build $(DOCKER_BUILD_FLAGS) --build-arg COMPILE_IMAGE=amazon/aws-for-fluent-bit:compile-init-al${AL_TAG} --build-arg RUNTIME_IMAGE=amazon/aws-for-fluent-bit:latest-al${AL_TAG} -t amazon/aws-for-fluent-bit:init-latest-al${AL_TAG} -f ./scripts/dockerfiles/runtime/Dockerfile.init .
8579

86-
.PHONY: init-debug
87-
init-debug: init-debug-s3
88-
docker tag amazon/aws-for-fluent-bit:init-debug-s3 amazon/aws-for-fluent-bit:init-debug
80+
.PHONY: debug
81+
debug: build-debug linux-plugins
82+
docker build $(DOCKER_BUILD_FLAGS) -t amazon/aws-for-fluent-bit:runtime-deps-debug-al${AL_TAG} -f ./scripts/dockerfiles/runtime/Dockerfile.deps-debug-al${AL_TAG} .
83+
docker build $(DOCKER_BUILD_FLAGS) --build-arg COMPILE_IMAGE=amazon/aws-for-fluent-bit:compile-debug-al${AL_TAG} --build-arg RUNTIME_IMAGE=amazon/aws-for-fluent-bit:runtime-deps-debug-al${AL_TAG} -t amazon/aws-for-fluent-bit:runtime-debug-al${AL_TAG} -f ./scripts/dockerfiles/runtime/Dockerfile .
84+
docker build $(DOCKER_BUILD_FLAGS) --build-arg RUNTIME_IMAGE=amazon/aws-for-fluent-bit:runtime-debug-al${AL_TAG} -t amazon/aws-for-fluent-bit:runtime-debug-common-${AL_TAG} -f ./scripts/dockerfiles/runtime/Dockerfile.debug-common .
85+
# s3 images
86+
docker build $(DOCKER_BUILD_FLAGS) --build-arg RUNTIME_IMAGE=amazon/aws-for-fluent-bit:runtime-debug-common-${AL_TAG} -t amazon/aws-for-fluent-bit:debug-al${AL_TAG} -f ./scripts/dockerfiles/runtime/Dockerfile.debug .
87+
docker build $(DOCKER_BUILD_FLAGS) --build-arg COMPILE_IMAGE=amazon/aws-for-fluent-bit:compile-init-al${AL_TAG} --build-arg RUNTIME_IMAGE=amazon/aws-for-fluent-bit:debug-al${AL_TAG} -t amazon/aws-for-fluent-bit:runtime-init-debug-al${AL_TAG} -f ./scripts/dockerfiles/runtime/Dockerfile.init .
88+
docker build $(DOCKER_BUILD_FLAGS) --build-arg RUNTIME_IMAGE=amazon/aws-for-fluent-bit:runtime-init-debug-al${AL_TAG} -t amazon/aws-for-fluent-bit:init-debug-al${AL_TAG} -f ./scripts/dockerfiles/runtime/Dockerfile.init-debug .
89+
# efs images
90+
docker build $(DOCKER_BUILD_FLAGS) --build-arg RUNTIME_IMAGE=amazon/aws-for-fluent-bit:runtime-debug-common-${AL_TAG} -t amazon/aws-for-fluent-bit:debug-efs-al${AL_TAG} -f ./scripts/dockerfiles/runtime/Dockerfile.debug-efs .
91+
docker build $(DOCKER_BUILD_FLAGS) --build-arg RUNTIME_IMAGE=amazon/aws-for-fluent-bit:runtime-init-debug-al${AL_TAG} -t amazon/aws-for-fluent-bit:init-debug-efs-al${AL_TAG} -f ./scripts/dockerfiles/runtime/Dockerfile.init-debug-efs .
8992

90-
# Build all main debug images (Don't build the dependencies multiple times)
91-
.PHONY: main-debug-all
92-
main-debug-all: main-debug-base
93-
docker build $(DOCKER_BUILD_FLAGS) -t amazon/aws-for-fluent-bit:debug-fs -f ./scripts/dockerfiles/Dockerfile.main-debug-fs .
94-
docker build $(DOCKER_BUILD_FLAGS) -t amazon/aws-for-fluent-bit:debug-s3 -f ./scripts/dockerfiles/Dockerfile.main-debug-s3 .
95-
docker build $(DOCKER_BUILD_FLAGS) -t amazon/aws-for-fluent-bit:debug-valgrind -f ./scripts/dockerfiles/Dockerfile.main-debug-valgrind .
96-
docker tag amazon/aws-for-fluent-bit:debug-s3 amazon/aws-for-fluent-bit:debug
93+
.PHONY: debug-valgrind
94+
debug-valgrind: debug
95+
docker build $(DOCKER_BUILD_FLAGS) --build-arg RUNTIME_IMAGE=amazon/aws-for-fluent-bit:runtime-debug-common-${AL_TAG} -t amazon/aws-for-fluent-bit:debug-valgrind-al${AL_TAG} -f ./scripts/dockerfiles/runtime/Dockerfile.debug-valgrind .
9796

98-
# Debug images
99-
.PHONY: debug-fs
100-
debug-fs: main-debug-base
101-
docker build $(DOCKER_BUILD_FLAGS) -t amazon/aws-for-fluent-bit:debug-fs -f ./scripts/dockerfiles/Dockerfile.main-debug-fs .
97+
.PHONY: cloudwatch-dev
98+
cloudwatch-dev: export OS_TYPE = linux
99+
cloudwatch-dev: build
100+
./scripts/build_plugins.sh \
101+
--CLOUDWATCH_PLUGIN_CLONE_URL=${CLOUDWATCH_PLUGIN_CLONE_URL} \
102+
--CLOUDWATCH_PLUGIN_BRANCH=${CLOUDWATCH_PLUGIN_BRANCH} \
103+
--DOCKER_BUILD_FLAGS=${DOCKER_BUILD_FLAGS}
104+
docker build $(DOCKER_BUILD_FLAGS) -t amazon/aws-for-fluent-bit:runtime-deps-al${AL_TAG} -f ./scripts/dockerfiles/runtime/Dockerfile.deps-al${AL_TAG} .
105+
docker build $(DOCKER_BUILD_FLAGS) --build-arg COMPILE_IMAGE=amazon/aws-for-fluent-bit:compile-al${AL_TAG} --build-arg RUNTIME_IMAGE=amazon/aws-for-fluent-bit:runtime-deps-al${AL_TAG} -t amazon/aws-for-fluent-bit:latest-al${AL_TAG} -f ./scripts/dockerfiles/runtime/Dockerfile .
102106

103-
.PHONY: debug-s3
104-
debug-s3: main-debug-base
105-
docker build $(DOCKER_BUILD_FLAGS) -t amazon/aws-for-fluent-bit:debug-s3 -f ./scripts/dockerfiles/Dockerfile.main-debug-s3 .
107+
.PHONY: firehose-dev
108+
firehose-dev: export OS_TYPE = linux
109+
firehose-dev: build
110+
./scripts/build_plugins.sh \
111+
--FIREHOSE_PLUGIN_CLONE_URL=${FIREHOSE_PLUGIN_CLONE_URL} \
112+
--FIREHOSE_PLUGIN_BRANCH=${FIREHOSE_PLUGIN_BRANCH} \
113+
--DOCKER_BUILD_FLAGS=${DOCKER_BUILD_FLAGS}
114+
docker build $(DOCKER_BUILD_FLAGS) -t amazon/aws-for-fluent-bit:runtime-deps-al${AL_TAG} -f ./scripts/dockerfiles/runtime/Dockerfile.deps-al${AL_TAG} .
115+
docker build $(DOCKER_BUILD_FLAGS) --build-arg COMPILE_IMAGE=amazon/aws-for-fluent-bit:compile-al${AL_TAG} --build-arg RUNTIME_IMAGE=amazon/aws-for-fluent-bit:runtime-deps-al${AL_TAG} -t amazon/aws-for-fluent-bit:latest-al${AL_TAG} -f ./scripts/dockerfiles/runtime/Dockerfile .
106116

107-
.PHONY: debug-valgrind
108-
debug-valgrind: main-debug-base
109-
docker build $(DOCKER_BUILD_FLAGS) -t amazon/aws-for-fluent-bit:debug-valgrind -f ./scripts/dockerfiles/Dockerfile.main-debug-valgrind .
110-
111-
# Build all init debug images (Don't build the dependencies multiple times)
112-
.PHONY: init-debug-all
113-
init-debug-all: main-debug-base build-init
114-
docker build $(DOCKER_BUILD_FLAGS) -t amazon/aws-for-fluent-bit:init-debug-base -f ./scripts/dockerfiles/Dockerfile.init-debug-base .
115-
docker build $(DOCKER_BUILD_FLAGS) -t amazon/aws-for-fluent-bit:init-debug-fs -f ./scripts/dockerfiles/Dockerfile.init-debug-fs .
116-
docker build $(DOCKER_BUILD_FLAGS) -t amazon/aws-for-fluent-bit:init-debug-s3 -f ./scripts/dockerfiles/Dockerfile.init-debug-s3 .
117-
docker tag amazon/aws-for-fluent-bit:init-debug-s3 amazon/aws-for-fluent-bit:init-debug
118-
119-
# Debug init images
120-
.PHONY: init-debug-fs
121-
init-debug-fs: main-debug-base build-init
122-
docker build $(DOCKER_BUILD_FLAGS) -t amazon/aws-for-fluent-bit:init-debug-base -f ./scripts/dockerfiles/Dockerfile.init-debug-base .
123-
docker build $(DOCKER_BUILD_FLAGS) -t amazon/aws-for-fluent-bit:init-debug-fs -f ./scripts/dockerfiles/Dockerfile.init-debug-fs .
124-
125-
.PHONY: init-debug-s3
126-
init-debug-s3: main-debug-base build-init
127-
docker build $(DOCKER_BUILD_FLAGS) -t amazon/aws-for-fluent-bit:init-debug-base -f ./scripts/dockerfiles/Dockerfile.init-debug-base .
128-
docker build $(DOCKER_BUILD_FLAGS) -t amazon/aws-for-fluent-bit:init-debug-s3 -f ./scripts/dockerfiles/Dockerfile.init-debug-s3 .
129-
130-
.PHONY: main-debug-base
131-
main-debug-base: build linux-plugins
132-
docker build $(DOCKER_BUILD_FLAGS) --build-arg AL_TAG=${AL_TAG} -t amazon/aws-for-fluent-bit:main-debug-base -f ./scripts/dockerfiles/Dockerfile.main-debug-base .
117+
.PHONY: kinesis-dev
118+
kinesis-dev: export OS_TYPE = linux
119+
kinesis-dev: build
120+
./scripts/build_plugins.sh \
121+
--KINESIS_PLUGIN_CLONE_URL=${KINESIS_PLUGIN_CLONE_URL} \
122+
--KINESIS_PLUGIN_BRANCH=${KINESIS_PLUGIN_BRANCH} \
123+
--DOCKER_BUILD_FLAGS=${DOCKER_BUILD_FLAGS}
124+
docker build $(DOCKER_BUILD_FLAGS) -t amazon/aws-for-fluent-bit:runtime-deps-al${AL_TAG} -f ./scripts/dockerfiles/runtime/Dockerfile.deps-al${AL_TAG} .
125+
docker build $(DOCKER_BUILD_FLAGS) --build-arg COMPILE_IMAGE=amazon/aws-for-fluent-bit:compile-al${AL_TAG} --build-arg RUNTIME_IMAGE=amazon/aws-for-fluent-bit:runtime-deps-al${AL_TAG} -t amazon/aws-for-fluent-bit:latest-al${AL_TAG} -f ./scripts/dockerfiles/runtime/Dockerfile .
133126

134127
.PHONY: validate-version-file-format
135128
validate-version-file-format:
136129
jq -e . windows.versions && true || false
137130
jq -e . linux.version && true || false
138131

139-
.PHONY: cloudwatch-dev
140-
cloudwatch-dev:
141-
docker build \
142-
--build-arg CLOUDWATCH_PLUGIN_CLONE_URL=${CLOUDWATCH_PLUGIN_CLONE_URL} \
143-
--build-arg CLOUDWATCH_PLUGIN_BRANCH=${CLOUDWATCH_PLUGIN_BRANCH} \
144-
$(DOCKER_BUILD_FLAGS) --build-arg AL_TAG=${AL_TAG} -t aws-fluent-bit-plugins:latest -f ./scripts/dockerfiles/Dockerfile.plugins .
145-
docker build -t amazon/aws-for-fluent-bit:latest -f ./scripts/dockerfiles/Dockerfile .
146-
147-
.PHONY: firehose-dev
148-
firehose-dev:
149-
docker build \
150-
--build-arg FIREHOSE_PLUGIN_CLONE_URL=${FIREHOSE_PLUGIN_CLONE_URL} \
151-
--build-arg FIREHOSE_PLUGIN_BRANCH=${FIREHOSE_PLUGIN_BRANCH} \
152-
$(DOCKER_BUILD_FLAGS) --build-arg AL_TAG=${AL_TAG} -t aws-fluent-bit-plugins:latest -f ./scripts/dockerfiles/Dockerfile.plugins .
153-
docker build -t amazon/aws-for-fluent-bit:latest -f ./scripts/dockerfiles/Dockerfile .
154-
155-
.PHONY: kinesis-dev
156-
kinesis-dev:
157-
docker build \
158-
--build-arg KINESIS_PLUGIN_CLONE_URL=${KINESIS_PLUGIN_CLONE_URL} \
159-
--build-arg KINESIS_PLUGIN_BRANCH=${KINESIS_PLUGIN_BRANCH} \
160-
$(DOCKER_BUILD_FLAGS) --build-arg AL_TAG=${AL_TAG} -t aws-fluent-bit-plugins:latest -f ./scripts/dockerfiles/Dockerfile.plugins .
161-
docker build -t amazon/aws-for-fluent-bit:latest -f ./scripts/dockerfiles/Dockerfile .
162-
163132
integ/out:
164133
mkdir -p integ/out
165134

@@ -214,26 +183,10 @@ delete-resources:
214183

215184
.PHONY: clean
216185
clean:
217-
rm -rf ./build
218-
rm -rf ./integ/out
219-
docker image remove -f aws-fluent-bit-plugins:latest
220-
221-
docker image remove -f amazon/aws-for-fluent-bit:latest
222-
docker image remove -f amazon/aws-for-fluent-bit:init-latest
223-
docker image remove -f amazon/aws-for-fluent-bit:debug
224-
docker image remove -f amazon/aws-for-fluent-bit:init-debug
225-
226-
docker image remove -f amazon/aws-for-fluent-bit:build
227-
docker image remove -f amazon/aws-for-fluent-bit:build-init
228-
docker image remove -f amazon/aws-for-fluent-bit:init-debug-base
229-
docker image remove -f amazon/aws-for-fluent-bit:main-debug-base
230-
231-
docker image remove -f amazon/aws-for-fluent-bit:init-release
232-
docker image remove -f amazon/aws-for-fluent-bit:main-release
233-
docker image remove -f amazon/aws-for-fluent-bit:debug-fs
234-
docker image remove -f amazon/aws-for-fluent-bit:debug-s3
235-
docker image remove -f amazon/aws-for-fluent-bit:debug-valgrind
236-
docker image remove -f amazon/aws-for-fluent-bit:init-debug-fs
237-
docker image remove -f amazon/aws-for-fluent-bit:init-debug-s3
238-
239-
docker image prune -f
186+
rm -rf ./build ./integ/out
187+
# Remove all amazon/aws-for-fluent-bit tagged images
188+
docker images --format "table {{.Repository}}:{{.Tag}}" | grep "^amazon/aws-for-fluent-bit:" | xargs -r docker image remove -f
189+
# Remove aws-fluent-bit-plugins images
190+
docker images --format "table {{.Repository}}:{{.Tag}}" | grep "^aws-fluent-bit-plugins:" | xargs -r docker image remove -f
191+
# Clean up dangling images
192+
docker image prune -a -f

README.md

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -401,9 +401,10 @@ The `AL_TAG` variable affects all Docker builds in the Makefile, including:
401401
- `make release` - Release image build
402402
- `make dev` - Development image build
403403
- `make build` - Main build target
404-
- `make build-init` - Init container build
405-
- `make main-debug-base` - Debug image build
406-
- Plugin builds (`linux-plugins`, `cloudwatch-plugins`, etc.)
404+
- `make build-common` - Common build dependencies
405+
- `make build-debug` - Debug build target
406+
- `make debug` - Debug images with multiple variants
407+
- Plugin builds (`linux-plugins`, `windows-plugins`, etc.)
407408

408409
##### Customizing Fluent Bit Version and Repository
409410

@@ -478,6 +479,43 @@ To run integration tests separately, execute `make integ-cloudwatch` or `make in
478479

479480
[Documentation on GitHub steps for releases](Release_Process.md).
480481

482+
#### Available Make Targets
483+
484+
**Main Build Targets:**
485+
- `make all` - Default target, builds release image (same as `make release`)
486+
- `make release` - Builds the production release image with `--no-cache` option
487+
- `make dev` - Builds the image with Docker caching enabled for faster development
488+
- `make build` - Main build target for compilation
489+
- `make build-common` - Builds common build dependencies
490+
- `make build-debug` - Builds debug version with debug symbols
491+
492+
**Debug Targets:**
493+
- `make debug` - Builds debug images with multiple variants (S3 and EFS)
494+
- `make debug-valgrind` - Builds debug image with Valgrind for memory debugging
495+
496+
**Plugin Build Targets:**
497+
- `make linux-plugins` - Builds all AWS plugins for Linux
498+
- `make windows-plugins` - Builds all AWS plugins for Windows
499+
- `make cloudwatch-dev` - Builds image with only CloudWatch plugin for development
500+
- `make firehose-dev` - Builds image with only Firehose plugin for development
501+
- `make kinesis-dev` - Builds image with only Kinesis plugin for development
502+
503+
**Integration Test Targets:**
504+
- `make integ` - Runs CICD integration tests
505+
- `make integ-dev` - Runs all integration tests in development mode
506+
- `make integ-cloudwatch` / `make integ-cloudwatch-dev` - CloudWatch integration tests
507+
- `make integ-kinesis` / `make integ-kinesis-dev` - Kinesis integration tests
508+
- `make integ-firehose` / `make integ-firehose-dev` - Firehose integration tests
509+
510+
**Cleanup Targets:**
511+
- `make integ-clean-cloudwatch` - Cleans up CloudWatch integration test resources
512+
- `make integ-clean-s3` - Cleans up S3 integration test resources
513+
- `make delete-resources` - Deletes all integration test resources
514+
- `make clean` - Removes build artifacts and Docker images
515+
516+
**Utility Targets:**
517+
- `make validate-version-file-format` - Validates the format of version files
518+
481519
#### Developing Features in the AWS Plugins
482520

483521
You can build a version of the image with code in your GitHub fork. To do so, you must need to set the following environment variables.

buildspec.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ phases:
1111
commands:
1212
# Check latest image versions from dockerhub and from GitHub source file
1313
- './scripts/publish.sh cicd-check-image-version'
14+
# Enable buildkit features
15+
- export DOCKER_BUILDKIT=1
1416
# Command to build debug image
1517
- make debug
1618
# Command to build your project
@@ -22,16 +24,16 @@ phases:
2224
# Push the image to ECR with corresponding architecture as the tag.
2325
- aws ecr get-login-password --region ${AWS_REGION}| docker login --username AWS --password-stdin ${AWS_ACCOUNT}.dkr.ecr.${AWS_REGION}.amazonaws.com
2426
- aws ecr create-repository --repository-name amazon/aws-for-fluent-bit-test --image-scanning-configuration scanOnPush=true --region ${AWS_REGION} || true
25-
- architecture=$(docker inspect --format='{{.Architecture}}' amazon/aws-for-fluent-bit)
26-
- docker tag amazon/aws-for-fluent-bit:latest ${AWS_ACCOUNT}.dkr.ecr.${AWS_REGION}.amazonaws.com/amazon/aws-for-fluent-bit-test:$architecture
27-
- docker tag amazon/aws-for-fluent-bit:debug ${AWS_ACCOUNT}.dkr.ecr.${AWS_REGION}.amazonaws.com/amazon/aws-for-fluent-bit-test:$architecture-debug
27+
- architecture=$(docker inspect --format='{{.Architecture}}' amazon/aws-for-fluent-bit:latest-al2)
28+
- docker tag amazon/aws-for-fluent-bit:latest-al2 ${AWS_ACCOUNT}.dkr.ecr.${AWS_REGION}.amazonaws.com/amazon/aws-for-fluent-bit-test:$architecture
29+
- docker tag amazon/aws-for-fluent-bit:debug-al2 ${AWS_ACCOUNT}.dkr.ecr.${AWS_REGION}.amazonaws.com/amazon/aws-for-fluent-bit-test:$architecture-debug
2830
- docker push ${AWS_ACCOUNT}.dkr.ecr.${AWS_REGION}.amazonaws.com/amazon/aws-for-fluent-bit-test:$architecture
2931
- docker push ${AWS_ACCOUNT}.dkr.ecr.${AWS_REGION}.amazonaws.com/amazon/aws-for-fluent-bit-test:$architecture-debug
3032
- './scripts/publish.sh cicd-verify-ecr-image-scan ${AWS_REGION} amazon/aws-for-fluent-bit-test $architecture'
3133
- './scripts/publish.sh cicd-verify-ecr-image-scan ${AWS_REGION} amazon/aws-for-fluent-bit-test $architecture-debug'
3234
# Image with Init Process
33-
- docker tag amazon/aws-for-fluent-bit:init-latest ${AWS_ACCOUNT}.dkr.ecr.${AWS_REGION}.amazonaws.com/amazon/aws-for-fluent-bit-test:init-$architecture
34-
- docker tag amazon/aws-for-fluent-bit:init-debug ${AWS_ACCOUNT}.dkr.ecr.${AWS_REGION}.amazonaws.com/amazon/aws-for-fluent-bit-test:init-$architecture-debug
35+
- docker tag amazon/aws-for-fluent-bit:init-latest-al2 ${AWS_ACCOUNT}.dkr.ecr.${AWS_REGION}.amazonaws.com/amazon/aws-for-fluent-bit-test:init-$architecture
36+
- docker tag amazon/aws-for-fluent-bit:init-debug-al2 ${AWS_ACCOUNT}.dkr.ecr.${AWS_REGION}.amazonaws.com/amazon/aws-for-fluent-bit-test:init-$architecture-debug
3537
- docker push ${AWS_ACCOUNT}.dkr.ecr.${AWS_REGION}.amazonaws.com/amazon/aws-for-fluent-bit-test:init-$architecture
3638
- docker push ${AWS_ACCOUNT}.dkr.ecr.${AWS_REGION}.amazonaws.com/amazon/aws-for-fluent-bit-test:init-$architecture-debug
3739
- './scripts/publish.sh cicd-verify-ecr-image-scan ${AWS_REGION} amazon/aws-for-fluent-bit-test init-$architecture'

0 commit comments

Comments
 (0)