Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve make docker-image #493

Merged
merged 3 commits into from
Oct 23, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ set-version:
clean:
mvn clean -P$(ALL_PROFILES)
mvn -f distribution/pom.xml clean
rm -rf ${DOCKER_CONTEXT}

## Run unit tests and checkstyle
unit-test:
Expand Down Expand Up @@ -91,15 +92,13 @@ quality: clean
quality-no-tests:
mvn -Dmaven.test.skip=true clean install -Pquality -Dmaven.test.skip=true

STYX_BUILD_ARTIFACT = $(shell find distribution/target -maxdepth 1 -name "styx*.zip")
STYX_LINUX_ARTIFACT = $(shell find distribution/target -maxdepth 1 -name "styx*linux-x86_64.zip")
STYX_HOME = $(CURRENT_DIR)/distribution/target/styx/styx
DOCKER_CONTEXT = $(CURRENT_DIR)/distribution/target/styx/docker
CONFIG_ROOT := $(STYX_HOME)/conf/env-$(STACK)

## Compile and create styx.zip then unzip into a directory defined by STYX_HOME
release-styx: release-no-tests
unzip -oq ${STYX_BUILD_ARTIFACT} -d $(dir ${STYX_HOME})
unzip -oq `find distribution/target -maxdepth 1 -name "styx*.zip"` -d $(dir ${STYX_HOME})

## Stops running netty-based origins (i.e. the origins started by start-origins)
stop-origins:
Expand Down Expand Up @@ -155,12 +154,9 @@ changelog:
# Assuming that styxconf.yml exists in "./docker-config/" directory.
# Default configuration file: /styx/default-config/default.yml
#
distribution/target/styx-1.0-SNAPSHOT-linux-x86_64.zip:
docker-image: clean
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I seems acceptable that we always have to clean and build to compile the docker image... But we could at least document how to build the docker-image without using the Makefile.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO the makefile itself can work as a documentation.

mvn install -Prelease,linux -Dmaven.test.skip=true

docker-image: ${STYX_LINUX_ARTIFACT}
rm -rf ${DOCKER_CONTEXT}
mkdir -p ${DOCKER_CONTEXT}
cp ${STYX_LINUX_ARTIFACT} ${DOCKER_CONTEXT}/styx.zip
cp `find distribution/target -maxdepth 1 -name "styx*linux-x86_64.zip"` ${DOCKER_CONTEXT}/styx.zip
cp docker/* ${DOCKER_CONTEXT}
docker build -t styxcore:latest --build-arg STYX_IMAGE=styx.zip -f docker/Dockerfile ${DOCKER_CONTEXT}/.
docker build -t styxcore:latest --build-arg STYX_IMAGE=styx.zip ${DOCKER_CONTEXT}/.