Skip to content

Commit

Permalink
TMP: push or load based on env
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinMind committed May 3, 2024
1 parent f1ee46c commit 539d877
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
16 changes: 1 addition & 15 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -363,27 +363,13 @@ commands:
echo 'export DOCKER_VERSION=<< parameters.image_tag >>' >> $BASH_ENV
echo 'export DOCKER_COMMIT=$CIRCLE_SHA1' >> $BASH_ENV
echo 'export VERSION_BUILD_URL=$CIRCLE_BUILD_URL' >> $BASH_ENV
echo 'export DOCKER_PUSH=<< parameters.push >>' >> $BASH_ENV
- run:
name: Build docker image and push to repo
command: |
docker version
docker login -u "${DOCKERHUB_USER}" -p "${DOCKERHUB_PASS}"
make build_docker_image
docker images
- when:
condition: << parameters.push >>
steps:
- run:
name: Push the docker image
command: |
docker compose push web
- unless:
condition: << parameters.push >>
steps:
- run:
name: Push the docker image (dry-run)
command: |
docker compose push web --dry-run
better_checkout:
description: circle ci checkout step on steroids
Expand Down
9 changes: 8 additions & 1 deletion Makefile-os
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ export DOCKER_BUILDER=container

DOCKER_PLATFORM := linux/amd64
DOCKER_PROGRESS := auto
DOCKER_PUSH := false
export DOCKER_COMMIT := $(shell git rev-parse HEAD || echo "commit")

export DOCKER_VERSION ?= local
export VERSION_BUILD_URL ?= build


.PHONY: help_redirect
help_redirect:
@$(MAKE) help --no-print-directory
Expand Down Expand Up @@ -53,10 +55,15 @@ create_docker_builder: ## Create a custom builder for buildkit to efficiently bu
--driver=docker-container

DOCKER_BUILD_ARGS := \
--load \
--progress=$(DOCKER_PROGRESS) \
--builder=$(DOCKER_BUILDER) \

ifeq ($(DOCKER_PUSH), true)
DOCKER_BUILD_ARGS += --push
else
DOCKER_BUILD_ARGS += --load
endif

.PHONY: version
version: ## create version.json file
./scripts/version.sh $(DOCKER_VERSION) $(DOCKER_COMMIT) $(VERSION_BUILD_URL)
Expand Down

0 comments on commit 539d877

Please sign in to comment.