Skip to content
This repository has been archived by the owner on Aug 14, 2024. It is now read-only.

Commit

Permalink
add support for custom CI build commands via $CUSTOM_CMD
Browse files Browse the repository at this point in the history
  • Loading branch information
whummer committed Oct 30, 2020
1 parent 3a83224 commit a835bd6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ install:

script:
- set -e # fail fast
# check if the build environment contains a special command via $CUSTOM_CMD
- if [ "$CUSTOM_CMD" = rebuild-base-image ]; then make docker-build-base-ci; exit; fi
# run tests using Python 3 (limit the set of tests to reduce test duration)
- DEBUG=1 LAMBDA_EXECUTOR=docker USE_SSL=1 TEST_ERROR_INJECTION=1 TEST_PATH="tests/integration/test_lambda.py tests/integration/test_integration.py" make test
# start pulling Docker base image in the background
Expand Down
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ IMAGE_NAME_BASE ?= localstack/java-maven-node-python
IMAGE_NAME_LIGHT ?= localstack/localstack-light
IMAGE_NAME_FULL ?= localstack/localstack-full
IMAGE_TAG ?= $(shell cat localstack/constants.py | grep '^VERSION =' | sed "s/VERSION = ['\"]\(.*\)['\"].*/\1/")
DOCKER_SQUASH ?= --squash
VENV_DIR ?= .venv
PIP_CMD ?= pip
TEST_PATH ?= .
Expand Down Expand Up @@ -60,10 +61,15 @@ docker-squash:
docker-squash -t $(IMAGE_NAME):$(IMAGE_TAG) $(IMAGE_NAME):$(IMAGE_TAG)

docker-build-base:
docker build --squash -t $(IMAGE_NAME_BASE) -f bin/Dockerfile.base .
docker build $(DOCKER_SQUASH) -t $(IMAGE_NAME_BASE) -f bin/Dockerfile.base .
docker tag $(IMAGE_NAME_BASE) $(IMAGE_NAME_BASE):$(IMAGE_TAG)
docker tag $(IMAGE_NAME_BASE):$(IMAGE_TAG) $(IMAGE_NAME_BASE):latest

docker-build-base-ci:
DOCKER_SQUASH= make docker-build-base
IMAGE_NAME=$(IMAGE_NAME_BASE) IMAGE_TAG=latest make docker-squash
docker push $(IMAGE_NAME_BASE):latest

docker-push: ## Push Docker image to registry
make docker-squash
docker push $(IMAGE_NAME):$(IMAGE_TAG)
Expand Down

0 comments on commit a835bd6

Please sign in to comment.