From 2d6afbc2f61c672449a2d8418f1ce0ec83df47c7 Mon Sep 17 00:00:00 2001
From: Seth Levine <sethlevi@amazon.com>
Date: Fri, 22 Oct 2021 11:23:06 -0400
Subject: [PATCH] Add Nightly Docker Build (#679)

---
 .github/workflows/nightly-build.yml | 16 +++++++++++++++-
 Makefile                            |  6 ++++++
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.yml
index 512fe9546a..2037512e44 100644
--- a/.github/workflows/nightly-build.yml
+++ b/.github/workflows/nightly-build.yml
@@ -27,4 +27,18 @@ jobs:
         run: make test
 
       - name: Unit test aws components
-        run: make test-aws-components
\ No newline at end of file
+        run: make test-aws-components
+
+      - name: Configure AWS Credentials
+        uses: aws-actions/configure-aws-credentials@v1
+        with:
+          aws-access-key-id: ${{ secrets.INTEG_TEST_AWS_KEY_ID }}
+          aws-secret-access-key: ${{ secrets.INTEG_TEST_AWS_KEY_SECRET }}
+          aws-region: us-east-1
+
+      - name: Login ECR
+        id: login-ecr
+        uses: aws-actions/amazon-ecr-login@v1
+
+      - name: upload to ECR
+        run: make docker-nightly
diff --git a/Makefile b/Makefile
index 0ec93b9ea3..0e66aecc0c 100644
--- a/Makefile
+++ b/Makefile
@@ -88,6 +88,12 @@ package-deb: build
 docker-build: 
 	docker build -t $(DOCKER_NAMESPACE)/$(COMPONENT):$(VERSION) -f ./cmd/$(COMPONENT)/Dockerfile .
 
+.PHONY: docker-nightly
+docker-nightly:
+	docker buildx create --use --name mybuildx
+	docker buildx build -t public.ecr.aws/aws-otel-test/nightly-build:latest -f ./cmd/$(COMPONENT)/Dockerfile --platform=linux/amd64 --push .
+	docker buildx rm mybuildx
+
 .PHONY: docker-push
 docker-push:
 	docker push $(DOCKER_NAMESPACE)/$(COMPONENT):$(VERSION)