Skip to content

Commit

Permalink
Direct push to remote repository
Browse files Browse the repository at this point in the history
  • Loading branch information
kwkwan committed Aug 31, 2023
1 parent e8f5bad commit cc38d4c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
15 changes: 1 addition & 14 deletions .github/workflows/build_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,4 @@ jobs:
NS_REMOTE: "${{ secrets.ACCOUNT_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com/${{ secrets.ACCOUNT_NAME }}"
DOCKER_LOGIN_CMD: "aws ecr get-login-password --region ${{ secrets.AWS_REGION }} | docker login --username AWS --password-stdin ${{ secrets.ACCOUNT_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com"
run: |
make build
- name: Deploy
if: ${{ success() }}
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
ACCOUNT_ID: ${{ secrets.ACCOUNT_ID }}
ACCOUNT_NAME: ${{ secrets.ACCOUNT_NAME }}
AWS_REGION: ${{ secrets.AWS_REGION }}
NS_REMOTE: "${{ secrets.ACCOUNT_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com/${{ secrets.ACCOUNT_NAME }}"
DOCKER_LOGIN_CMD: "aws ecr get-login-password --region ${{ secrets.AWS_REGION }} | docker login --username AWS --password-stdin ${{ secrets.ACCOUNT_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com"
run: |
make tp
make build-push
19 changes: 18 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ define ROOT_IMAGE_TASKS
# Comment this out when debugging
.INTERMEDIATE: $(3)/Dockerfile

.PHONY: build-$(3) clean-local-$(3) kill-$(3) rm-$(3) \
.PHONY: build-$(3) build-push-$(3) clean-local-$(3) kill-$(3) rm-$(3) \
rmf-$(3) squash-$(3) tag-$(3) push-$(3) sp-$(3) \
bsp-$(3) tp-$(3) btp-$(3) bt-$(3) bs-$(3) \
clean-remote-$(3) run-$(3)
Expand All @@ -84,6 +84,7 @@ $(3)/Dockerfile:
echo "$$$${FROM_LINE_EVALED}" > $$@; \
sed '1d' $$@.in >> $$@

# Use this option when local docker supports multi plaform
build-$(3): $(3)/Dockerfile
docker buildx build --rm \
--platform linux/amd64,linux/arm64 \
Expand All @@ -99,6 +100,21 @@ build-$(3): $(3)/Dockerfile
--label ribose-base-container-commit-branch=$(CONTAINER_BRANCH) \
.

build-push-$(3): $(3)/Dockerfile
docker buildx build --rm \
--platform linux/amd64,linux/arm64 \
--output type=image,name=$(CONTAINER_REMOTE_NAME),push=true \
-t $(CONTAINER_REMOTE_NAME) \
-f $(3)/Dockerfile \
--label ribose-base-container-root=$(2) \
--label ribose-base-container-source=$(REPO_GIT_NAME)/$(3) \
--label ribose-base-container=$(CONTAINER_REMOTE_NAME) \
--label ribose-base-container-remote=$(CONTAINER_REMOTE_NAME) \
--label ribose-base-container-version=$(1) \
--label ribose-base-container-commit=$(CONTAINER_COMMIT) \
--label ribose-base-container-commit-branch=$(CONTAINER_BRANCH) \
.

clean-local-$(3):
docker rmi -f $(CONTAINER_LOCAL_NAME)

Expand Down Expand Up @@ -161,4 +177,5 @@ endef
$(foreach i,$(ITEMS),$(eval $(call ROOT_IMAGE_TASKS,$(call GET_VERSION,$i),$(call GET_ROOT_IMAGE,$i),$(call GET_IMAGE_TYPE,$i),$(CONTAINER_TYPE))))

build: $(addprefix build-, $(notdir $(IMAGE_TYPES)))
build-push: $(addprefix build-push-, $(notdir $(IMAGE_TYPES)))
tp: $(addprefix tp-, $(notdir $(IMAGE_TYPES)))

0 comments on commit cc38d4c

Please sign in to comment.