diff --git a/tools/docker/Makefile b/tools/docker/Makefile index cbb26dc36ba..7e9dda9bec8 100644 --- a/tools/docker/Makefile +++ b/tools/docker/Makefile @@ -1,143 +1,421 @@ # General commands +.PHONY: help +help: + @echo "Tools to generate various deliveries for linux distros" + @echo "<distro>: debian-9, centos-7, ubuntu-14.04, ubuntu-16.04, ubuntu-17.10, ubuntu-18.04, all" + @echo "<language>: cc, java, dotnet, all" + @echo + @echo "usage:" + @echo "make help: Print this help." + @echo "make delivery: Build 'archives' and 'python' targets." + @echo "make test_delivery: Build 'test_archives' and 'test_python' targets." + @echo + @echo "make archives: Build all OR-Tools archives in export." + @echo "make test_archives: Test all OR-Tools archives in export for each language." + @echo "make python: Build manylinux python 'ortools' wheel packages (2.7, 3.5, 3.6, 3.7)." + @echo "make test_python: Test manylinux python 'ortools' wheel packages (2.7, 3.5, 3.6, 3.7)." + @echo + @echo "make docker_<distro>: Build image containing or-tools with its third party prebuilt." + @echo "make bash_<distro>: Run container using the docker_<distro> image." + @echo "make archive_<distro>: Build OR-Tools archive for the specified <distro>." + @echo "make docker_<distro>_<lang>: Build test image containing or-tools archive and <lang> prerequisites." + @echo "make test_<distro>_<lang>: Test OR-Tools archive for the specified <distro> and <lang>." + @echo "make bash_<distro>_<lang>: Run container using the docker_<distro>_<lang> image." + @echo "make test_<distro>: Test OR-Tools archive for all specified language for the specified <distro>." + @echo + @echo "make test_<distro>_<language>: Test OR-Tools archive on <distro> distro for <language> language." + @echo "make clean: Clean all docker images but keep archives (aka don\'t touch export directory)." + @echo "make distclean: Clean all docker images and remove all archives." + @echo + +# keep all intermediate files e.g. export/docker_*.tar +# src: https://www.gnu.org/software/make/manual/html_node/Special-Targets.html +.SECONDARY: + +OR_TOOLS_BRANCH := $(shell git rev-parse --abbrev-ref HEAD) +OR_TOOLS_SHA1 := $(shell git rev-parse --verify HEAD) +$(info branch: $(OR_TOOLS_BRANCH)) +include ../../Version.txt +OR_TOOLS_PATCH := $(shell git rev-list --count HEAD) +OR_TOOLS_VERSION := $(OR_TOOLS_MAJOR).$(OR_TOOLS_MINOR).$(OR_TOOLS_PATCH) +$(info version: $(OR_TOOLS_VERSION)) +DOCKER_RUN_CMD := docker run --rm -it --init +#DOCKER_BUILD_CMD := docker build --no-cache +DOCKER_BUILD_CMD := docker build + +################# +### DELIVERY ## +################# +.PHONY: delivery +delivery: python archives + +.PHONY: test_delivery +test_delivery: test_python test_archives + +############### +### PYTHON ## +############### + +.PHONY: python +python: manylinux1-pypi +# manylinux1 images +manylinux1-image: | export + docker build \ + -f manylinux1.Dockerfile \ + --build-arg SRC_GIT_BRANCH=$(OR_TOOLS_BRANCH) \ + -t or-tools_manylinux1 . + +manylinux1-image-no-cache: | export + docker build --no-cache \ + -f manylinux1.Dockerfile \ + --build-arg SRC_GIT_BRANCH=$(OR_TOOLS_BRANCH) \ + -t or-tools_manylinux1 . + +manylinux1-pypi: manylinux1-images + docker run -v `pwd`/export:/export or-tools_manylinux1:latest /bin/bash -c \ + "/root/build/build-manylinux1.sh /root/src /root/build /export" + +manylinux1-bash: manylinux1-image + $(DOCKER_RUN_CMD) or-tools_manylinux1:latest /bin/bash + +.PHONY: test_python +test_python: manylinux1-test + +################# +### ARCHIVES ## +################# + +# Create build docker images with OR-Tools built +.PHONY: docker \ +docker_centos-7 \ +docker_debian-9 \ +docker_ubuntu-14.04 \ +docker_ubuntu-16.04 \ +docker_ubuntu-17.10 \ +docker_ubuntu-18.04 +docker: \ +docker_centos-7 \ +docker_debian-9 \ +docker_ubuntu-14.04 \ +docker_ubuntu-16.04 \ +docker_ubuntu-17.10 \ +docker_ubuntu-18.04 +docker_centos-7: export/centos-7/docker.tar +docker_debian-9: export/debian-9/docker.tar +docker_ubuntu-14.04: export/ubuntu-14.04/docker.tar +docker_ubuntu-16.04: export/ubuntu-16.04/docker.tar +docker_ubuntu-17.10: export/ubuntu-17.10/docker.tar +docker_ubuntu-18.04: export/ubuntu-18.04/docker.tar + +# Performance: `docker build` use export/$* to reduce the size of the context +# since everything inside this directory is sent to the docker daemon +# before the image is built... +export/%/docker.tar: %.Dockerfile ../Makefile.cc.java.dotnet ../../makefiles ../../ortools | export/% + -docker image rm -f or-tools_$*:devel 2>/dev/null + $(DOCKER_BUILD_CMD) \ + -f $< \ + --build-arg SRC_GIT_BRANCH=$(OR_TOOLS_BRANCH) \ + --build-arg SRC_GIT_SHA1=$(OR_TOOLS_SHA1) \ + -t or-tools_$*:devel export/$* + docker save or-tools_$*:devel -o $@ + +# Run container using devel docker image +.PHONY: bash_centos-7 bash_debian-9 bash_ubuntu-14.04 bash_ubuntu-16.04 bash_ubuntu-17.10 bash_ubuntu-18.04 +bash_centos-7: export/centos-7/docker.tar + $(DOCKER_RUN_CMD) or-tools_centos-7:devel /bin/bash +bash_debian-9: export/debian-9/docker.tar + $(DOCKER_RUN_CMD) or-tools_debian-9:devel /bin/bash +bash_ubuntu-14.04: export/ubuntu-14.04/docker.tar + $(DOCKER_RUN_CMD) or-tools_ubuntu-14.04:devel /bin/bash +bash_ubuntu-16.04: export/ubuntu-16.04/docker.tar + $(DOCKER_RUN_CMD) or-tools_ubuntu-16.04:devel /bin/bash +bash_ubuntu-17.10: export/ubuntu-17.10/docker.tar + $(DOCKER_RUN_CMD) or-tools_ubuntu-17.10:devel /bin/bash +bash_ubuntu-18.04: export/ubuntu-18.04/docker.tar + $(DOCKER_RUN_CMD) or-tools_ubuntu-18.04:devel /bin/bash + +# Build Archives +.PHONY: archive \ +archive_centos-7 \ +archive_debian-9 \ +archive_ubuntu-14.04 \ +archive_ubuntu-16.04 \ +archive_ubuntu-17.10 \ +archive_ubuntu-18.04 +archive: \ +archive_centos-7 \ +archive_debian-9 \ +archive_ubuntu-14.04 \ +archive_ubuntu-16.04 \ +archive_ubuntu-17.10 \ +archive_ubuntu-18.04 +archive_centos-7: export/archives/or-tools_centos-7_v$(OR_TOOLS_VERSION).tar.gz +archive_debian-9: export/archives/or-tools_debian-9_v$(OR_TOOLS_VERSION).tar.gz +archive_ubuntu-14.04: export/archives/or-tools_ubuntu-14.04_v$(OR_TOOLS_VERSION).tar.gz +archive_ubuntu-16.04: export/archives/or-tools_ubuntu-16.04_v$(OR_TOOLS_VERSION).tar.gz +archive_ubuntu-17.10: export/archives/or-tools_ubuntu-17.10_v$(OR_TOOLS_VERSION).tar.gz +archive_ubuntu-18.04: export/archives/or-tools_ubuntu-18.04_v$(OR_TOOLS_VERSION).tar.gz + +export/archives/or-tools_%_v$(OR_TOOLS_VERSION).tar.gz: export/%/docker.tar | export/archives + -rm -f export/archives/or-tools_$*_v*.tar.gz + -rm -f export/archives/or-tools_flatzinc_$*_v*.tar.gz + docker load -i $< + $(DOCKER_RUN_CMD) -w /root/or-tools -v `pwd`/export:/export or-tools_$*:devel /bin/sh -c \ + "make test; make archive; cp *.tar.gz /export/$*" + $(DOCKER_RUN_CMD) -w /root/or-tools -v `pwd`/export:/export or-tools_$*:devel /bin/sh -c \ + "make test_fz; make fz_archive; cp *.tar.gz /export/$*" + mv export/$*/or-tools_flatzinc_*.tar.gz export/archives/or-tools_flatzinc_$*_v$(OR_TOOLS_VERSION).tar.gz + mv export/$*/or-tools_*.tar.gz export/archives/or-tools_$*_v$(OR_TOOLS_VERSION).tar.gz + +# Export Dir export: - mkdir export - + -mkdir $@ +# generic rule export/% prevent other rules +# e.g. export/%/docker.devel.tar -> need an exhaustive list +export/archives: | export + -mkdir $@ +export/centos-7: | export + -mkdir $@ +export/debian-9: | export + -mkdir $@ +export/ubuntu-14.04: | export + -mkdir $@ +export/ubuntu-16.04: | export + -mkdir $@ +export/ubuntu-17.10: | export + -mkdir $@ +export/ubuntu-18.04: | export + -mkdir $@ + +############ +## TEST ## +############ + +# Create test docker image for each language +.PHONY: \ +docker_centos-7_cc docker_centos-7_java docker_centos-7_dotnet \ +docker_debian-9_cc docker_debian-9_java docker_debian-9_dotnet \ +docker_ubuntu-14.04_cc docker_ubuntu-14.04_java docker_ubuntu-14.04_dotnet \ +docker_ubuntu-16.04_cc docker_ubuntu-16.04_java docker_ubuntu-16.04_dotnet \ +docker_ubuntu-17.10_cc docker_ubuntu-17.10_java docker_ubuntu-17.10_dotnet \ +docker_ubuntu-18.04_cc docker_ubuntu-18.04_java docker_ubuntu-18.04_dotnet +docker_centos-7_cc: export/centos-7/docker_cc.tar +docker_centos-7_java: export/centos-7/docker_java.tar +docker_centos-7_donet: export/centos-7/docker_dotnet.tar + +docker_debian-9_cc: export/debian-9/docker_cc.tar +docker_debian-9_java: export/debian-9/docker_java.tar +docker_debian-9_dotnet: export/debian-9/docker_dotnet.tar + +docker_ubuntu-14.04_cc: export/ubuntu-14.04/docker_cc.tar +docker_ubuntu-14.04_java: export/ubuntu-14.04/docker_java.tar +docker_ubuntu-14.04_dotnet: export/ubuntu-14.04/docker_dotnet.tar + +docker_ubuntu-16.04_cc: export/ubuntu-16.04/docker_cc.tar +docker_ubuntu-16.04_java: export/ubuntu-16.04/docker_java.tar +docker_ubuntu-16.04_dotnet: export/ubuntu-16.04/docker_dotnet.tar + +docker_ubuntu-17.10_cc: export/ubuntu-17.10/docker_cc.tar +docker_ubuntu-17.10_java: export/ubuntu-17.10/docker_java.tar +docker_ubuntu-17.10_dotnet: export/ubuntu-17.10/docker_dotnet.tar + +docker_ubuntu-18.04_cc: export/ubuntu-18.04/docker_cc.tar +docker_ubuntu-18.04_java: export/ubuntu-18.04/docker_java.tar +docker_ubuntu-18.04_dotnet: export/ubuntu-18.04/docker_dotnet.tar + +export/%/docker_cc.tar: test/%/cc.Dockerfile export/archives/or-tools_%_v$(OR_TOOLS_VERSION).tar.gz + -docker image rm -f or-tools_$*:cc 2>/dev/null + $(DOCKER_BUILD_CMD) -f $< -t or-tools_$*:cc export/archives + docker save or-tools_$*:cc -o $@ +export/%/docker_java.tar: test/%/java.Dockerfile export/archives/or-tools_%_v$(OR_TOOLS_VERSION).tar.gz + -docker image rm -f or-tools_$*:java 2>/dev/null + $(DOCKER_BUILD_CMD) -f $< -t or-tools_$*:java export/archives + docker save or-tools_$*:java -o $@ +export/%/docker_dotnet.tar: test/%/dotnet.Dockerfile export/archives/or-tools_%_v$(OR_TOOLS_VERSION).tar.gz + -docker image rm -f or-tools_$*:dotnet 2>/dev/null + $(DOCKER_BUILD_CMD) -f $< -t or-tools_$*:dotnet export/archives + docker save or-tools_$*:dotnet -o $@ + +# Run container using <language> docker image +.PHONY: bash_centos-7_cc bash_centos-7_java bash_centos-7_dotnet +bash_centos-7_cc: export/centos-7/docker_cc.tar + $(DOCKER_RUN_CMD) or-tools_centos-7:cc /bin/bash +bash_centos-7_java: export/centos-7/docker_java.tar + $(DOCKER_RUN_CMD) or-tools_centos-7:java /bin/bash +bash_centos-7_dotnet: export/centos-7/docker_dotnet.tar + $(DOCKER_RUN_CMD) or-tools_centos-7:dotnet /bin/bash + +.PHONY: bash_debian-9_cc bash_debian-9_java bash_debian-9_dotnet +bash_debian-9_cc: export/debian-9/docker_cc.tar + $(DOCKER_RUN_CMD) or-tools_debian-9:cc /bin/bash +bash_debian-9_java: export/debian-9/docker_java.tar + $(DOCKER_RUN_CMD) or-tools_debian-9:java /bin/bash +bash_debian-9_dotnet: export/debian-9/docker_dotnet.tar + $(DOCKER_RUN_CMD) or-tools_debian-9:dotnet /bin/bash + +.PHONY: bash_ubuntu-14.04_cc bash_ubuntu-14.04_java bash_ubuntu-14.04_dotnet +bash_ubuntu-14.04_cc: export/ubuntu-14.04/docker_cc.tar + $(DOCKER_RUN_CMD) or-tools_ubuntu-14.04:cc /bin/bash +bash_ubuntu-14.04_java: export/ubuntu-14.04/docker_java.tar + $(DOCKER_RUN_CMD) or-tools_ubuntu-14.04:java /bin/bash +bash_ubuntu-14.04_dotnet: export/ubuntu-14.04/docker_dotnet.tar + $(DOCKER_RUN_CMD) or-tools_ubuntu-14.04:dotnet /bin/bash + +.PHONY: bash_ubuntu-16.04_cc bash_ubuntu-16.04_java bash_ubuntu-16.04_dotnet +bash_ubuntu-16.04_cc: export/ubuntu-16.04/docker_cc.tar + $(DOCKER_RUN_CMD) or-tools_ubuntu-16.04:cc /bin/bash +bash_ubuntu-16.04_java: export/ubuntu-16.04/docker_java.tar + $(DOCKER_RUN_CMD) or-tools_ubuntu-16.04:java /bin/bash +bash_ubuntu-16.04_dotnet: export/ubuntu-16.04/docker_dotnet.tar + $(DOCKER_RUN_CMD) or-tools_ubuntu-16.04:dotnet /bin/bash + +.PHONY: bash_ubuntu-17.10_cc bash_ubuntu-17.10_java bash_ubuntu-17.10_dotnet +bash_ubuntu-17.10_cc: export/ubuntu-17.10/docker_cc.tar + $(DOCKER_RUN_CMD) or-tools_ubuntu-17.10:cc /bin/bash +bash_ubuntu-17.10_java: export/ubuntu-17.10/docker_java.tar + $(DOCKER_RUN_CMD) or-tools_ubuntu-17.10:java /bin/bash +bash_ubuntu-17.10_dotnet: export/ubuntu-17.10/docker_dotnet.tar + $(DOCKER_RUN_CMD) or-tools_ubuntu-17.10:dotnet /bin/bash + +.PHONY: bash_ubuntu-18.04_cc bash_ubuntu-18.04_java bash_ubuntu-18.04_dotnet +bash_ubuntu-18.04_cc: export/ubuntu-18.04/docker_cc.tar + $(DOCKER_RUN_CMD) or-tools_ubuntu-18.04:cc /bin/bash +bash_ubuntu-18.04_java: export/ubuntu-18.04/docker_java.tar + $(DOCKER_RUN_CMD) or-tools_ubuntu-18.04:java /bin/bash +bash_ubuntu-18.04_dotnet: export/ubuntu-18.04/docker_dotnet.tar + $(DOCKER_RUN_CMD) or-tools_ubuntu-18.04:dotnet /bin/bash + +# Test Archive +.PHONY: test_archives test_archives_cc test_archives_java test_archives_dotnet \ +test_centos-7 \ +test_debian-9 \ +test_ubuntu-14.04 \ +test_ubuntu-16.04 \ +test_ubuntu-17.10 \ +test_ubuntu-18.04 +test_archives: \ +test_centos-7 \ +test_debian-9 \ +test_ubuntu-14.04 \ +test_ubuntu-16.04 \ +test_ubuntu-17.10 \ +test_ubuntu-18.04 + +test_archives_cc: \ +test_centos-7_cc \ +test_debian-9_cc \ +test_ubuntu-14.04_cc \ +test_ubuntu-16.04_cc \ +test_ubuntu-17.10_cc \ +test_ubuntu-18.04_cc + +test_archives_java: \ +test_centos-7_java \ +test_debian-9_java \ +test_ubuntu-14.04_java \ +test_ubuntu-16.04_java \ +test_ubuntu-17.10_java \ +test_ubuntu-18.04_java + +test_archives_dotnet: \ +test_centos-7_dotnet \ +test_debian-9_dotnet \ +test_ubuntu-14.04_dotnet \ +test_ubuntu-16.04_dotnet \ +test_ubuntu-17.10_dotnet \ +test_ubuntu-18.04_dotnet + +test_centos-7: test_centos-7_cc test_centos-7_java test_centos-7_dotnet +test_debian-9: test_debian-9_cc test_debian-9_java test_debian-9_dotnet +test_ubuntu-14.04: test_ubuntu-14.04_cc test_ubuntu-14.04_java test_ubuntu-14.04_dotnet +test_ubuntu-16.04: test_ubuntu-16.04_cc test_ubuntu-16.04_java test_ubuntu-16.04_dotnet +test_ubuntu-17.10: test_ubuntu-17.10_cc test_ubuntu-17.10_java test_ubuntu-17.10_dotnet +test_ubuntu-18.04: test_ubuntu-18.04_cc test_ubuntu-18.04_java test_ubuntu-18.04_dotnet + +.PHONY: test_centos-7_cc test_centos-7_java test_centos-7_dotnet +test_centos-7_cc: export/centos-7/test_cc.log +test_centos-7_java: export/centos-7/test_java.log +test_centos-7_dotnet: export/centos-7/test_dotnet.log + +.PHONY: test_debian-9_cc test_debian-9_java test_debian-9_dotnet +test_debian-9_cc: export/debian-9/test_cc.log +test_debian-9_java: export/debian-9/test_java.log +test_debian-9_dotnet: export/debian-9/test_dotnet.log + +.PHONY: test_ubuntu-14.04_cc test_ubuntu-14.04_java test_ubuntu-14.04_dotnet +test_ubuntu-14.04_cc: export/ubuntu-14.04/test_cc.log +test_ubuntu-14.04_java: export/ubuntu-14.04/test_java.log +test_ubuntu-14.04_dotnet: export/ubuntu-14.04/test_dotnet.log + +.PHONY: test_ubuntu-16.04_cc test_ubuntu-16.04_java test_ubuntu-16.04_dotnet +test_ubuntu-16.04_cc: export/ubuntu-16.04/test_cc.log +test_ubuntu-16.04_java: export/ubuntu-16.04/test_java.log +test_ubuntu-16.04_dotnet: export/ubuntu-16.04/test_dotnet.log + +.PHONY: test_ubuntu-17.10_cc test_ubuntu-17.10_java test_ubuntu-17.10_dotnet +test_ubuntu-17.10_cc: export/ubuntu-17.10/test_cc.log +test_ubuntu-17.10_java: export/ubuntu-17.10/test_java.log +test_ubuntu-17.10_dotnet: export/ubuntu-17.10/test_dotnet.log + +.PHONY: test_ubuntu-18.04_cc test_ubuntu-18.04_java test_ubuntu-18.04_dotnet +test_ubuntu-18.04_cc: export/ubuntu-18.04/test_cc.log +test_ubuntu-18.04_java: export/ubuntu-18.04/test_java.log +test_ubuntu-18.04_dotnet: export/ubuntu-18.04/test_dotnet.log + +export/%/test_cc.log: export/%/docker_cc.tar + docker load -i $< + $(DOCKER_RUN_CMD) or-tools_$*:cc /bin/sh -c "cd or-tools_*_v* && make test_cc" | tee $@ + rm $@ +export/%/test_java.log: export/%/docker_java.tar + docker load -i $< + $(DOCKER_RUN_CMD) or-tools_$*:java /bin/sh -c "cd or-tools_*_v* && make test_java" | tee $@ + rm $@ +export/%/test_dotnet.log: export/%/docker_dotnet.tar + docker load -i $< + $(DOCKER_RUN_CMD) or-tools_$*:dotnet /bin/sh -c "cd or-tools_*_v* && make test_dotnet" | tee $@ + rm $@ + +############# +## CLEAN ## +############# +.PHONY: clean +clean: clean_containers clean_images + +.PHONY: clean_images +clean_images: clean_containers + -docker image ls --all + -docker image prune --force + +.PHONY: clean_containers +clean_containers: + -docker container ls --all + -docker container rm $$(docker container ls -f status=exited -q) + +.PHONY: distclean +distclean: clean + -docker container rm $$(docker container ls --all -q) + -docker image rm $$(docker image ls --all -q) + rm -rf export + +################# +## DEPRECATED ## +################# +.PHONY: images images: \ ubuntu-14.04-image \ ubuntu-16.04-image \ ubuntu-17.10-image \ + ubuntu-18.04-image \ centos-7-image \ debian-9-image \ manylinux1-image +.PHONY: images-no-cache images-no-cache: \ ubuntu-14.04-image-no-cache \ ubuntu-16.04-image-no-cache \ ubuntu-17.10-image-no-cache \ + ubuntu-18.04-image-no-cache \ centos-7-image-no-cache \ debian-9-image-no-cache - -clean_all_images: - docker rmi `docker images -q -a` - -clean_all_containers: - docker rm `docker ps -a -q` - -archives: \ - centos-7-archive \ - debian-9-archive \ - ubuntu-14.04-archive \ - ubuntu-16.04-archive \ - ubuntu-17.10-archive - -python: manylinux1-pypi - -test: \ - centos-7-test \ - debian-9-test \ - ubuntu-14.04-test \ - ubuntu-16.04-test \ - ubuntu-17.10-test - -delivery: archives python - -# Ubuntu 14.04 images - -ubuntu-14.04-image: - docker build -f ubuntu-14.04.Dockerfile -t or-tools-ubuntu-14.04-image . - -ubuntu-14.04-image-no-cache: - docker build --no-cache -f ubuntu-14.04.Dockerfile -t or-tools-ubuntu-14.04-image . - -ubuntu-14.04-archive: export ubuntu-14.04-image - docker run -w /root/or-tools -v `pwd`/export:/export or-tools-ubuntu-14.04-image:latest /bin/bash -c "git pull; make clean; make all -j 5; make test; make archive fz_archive; cp *.tar.gz /export" - -ubuntu-14.04-test: export ubuntu-14.04-image - docker run -w /root/or-tools -v `pwd`/export:/export or-tools-ubuntu-14.04-image:latest /bin/bash -c "git pull; make clean; make all -j 5; make test" - -ubuntu-14.04-bash: export ubuntu-14.04-image - docker run -it or-tools-ubuntu-14.04-image:latest /bin/bash - -# Ubuntu 16.06 images - -ubuntu-16.04-image: - docker build -f ubuntu-16.04.Dockerfile -t or-tools-ubuntu-16.04-image . - -ubuntu-16.04-image-no-cache: - docker build --no-cache -f ubuntu-16.04.Dockerfile -t or-tools-ubuntu-16.04-image . - -ubuntu-16.04-archive: export ubuntu-16.04-image - docker run -w /root/or-tools -v `pwd`/export:/export or-tools-ubuntu-16.04-image:latest /bin/bash -c "git pull; make clean; make all -j 5; make test; make archive fz_archive; cp *.tar.gz /export" - -ubuntu-16.04-test: export ubuntu-16.04-image - docker run -w /root/or-tools -v `pwd`/export:/export or-tools-ubuntu-16.04-image:latest /bin/bash -c "git pull; make clean; make all -j 5; make test" - -ubuntu-16.04-bash: export ubuntu-16.04-image - docker run -it or-tools-ubuntu-16.04-image:latest /bin/bash - -# Ubuntu 17.10 images - -ubuntu-17.10-image: - docker build -f ubuntu-17.10.Dockerfile -t or-tools-ubuntu-17.10-image . - -ubuntu-17.10-image-no-cache: - docker build --no-cache -f ubuntu-17.10.Dockerfile -t or-tools-ubuntu-17.10-image . - -ubuntu-17.10-archive: export ubuntu-17.10-image - docker run -w /root/or-tools -v `pwd`/export:/export or-tools-ubuntu-17.10-image:latest /bin/bash -c \ - "git pull; \ - make clean; \ - make all -j 5; \ - make test; \ - make archive fz_archive; \ - cp *.tar.gz /export" - -ubuntu-17.10-test: export ubuntu-17.10-image - docker run -w /root/or-tools -v `pwd`/export:/export or-tools-ubuntu-17.10-image:latest /bin/bash -c \ - "git pull; \ - make clean; \ - make all -j 5; \ - make test" - -# Debian 9 images - -debian-9-image: - docker build -f debian-9.Dockerfile -t or-tools-debian-9-image . - -debian-9-image-no-cache: - docker build --no-cache -f debian-9.Dockerfile -t or-tools-debian-9-image . - -debian-9-archive: export debian-9-image - docker run -w /root/or-tools -v `pwd`/export:/export or-tools-debian-9-image:latest /bin/bash -c "git pull; make clean; make all -j 5; make test; make archive fz_archive; cp *.tar.gz /export" - -debian-9-test: export debian-9-image - docker run -w /root/or-tools -v `pwd`/export:/export or-tools-debian-9-image:latest /bin/bash -c "git pull; make clean; make all -j 5; make test" - -# Centos 7 images - -centos-7-image: - docker build -f centos-7.Dockerfile -t or-tools-centos-7-image . - -centos-7-image-no-cache: - docker build --no-cache -f centos-7.Dockerfile -t or-tools-centos-7-image . - -centos-7-archive: export centos-7-image - docker run -w /root/or-tools -v `pwd`/export:/export or-tools-centos-7-image:latest /bin/bash -c "git pull; make clean; make all -j 5; make test; make archive fz_archive; cp *.tar.gz /export" - -centos-7-test: export centos-7-image - docker run -w /root/or-tools -v `pwd`/export:/export or-tools-centos-7-image:latest /bin/bash -c "git pull; make clean; make all -j 5; make test" - -# manylinux1 images - -manylinux1-image: - docker build -f manylinux1.Dockerfile -t or-tools-manylinux1-image . - -manylinux1-image-no-cache: - docker build --no-cache -f manylinux1.Dockerfile -t or-tools-manylinux1-image . - -manylinux1-pypi: export manylinux1-image - docker run -v `pwd`/export:/export or-tools-manylinux1-image:latest /bin/bash -c "/root/build/build-manylinux1.sh /root/src /root/build /export" - -manylinux1-bash: export manylinux1-image - docker run --rm -it --init or-tools-manylinux1-image:latest /bin/bash diff --git a/tools/docker/centos-7.Dockerfile b/tools/docker/centos-7.Dockerfile index 3e5b36d4300..7d69feabb4c 100644 --- a/tools/docker/centos-7.Dockerfile +++ b/tools/docker/centos-7.Dockerfile @@ -1,66 +1,70 @@ FROM centos:7 -ENV SRC_GIT_BRANCH master - -RUN yum -y update - -RUN yum -y install yum-utils - -RUN rpm --import "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF" - -RUN yum-config-manager --add-repo http://download.mono-project.com/repo/centos7/ - -RUN yum -y \ - install \ - wget \ - git \ - autoconf \ - libtool \ - zlib-devel \ - gawk \ - gcc-c++ \ - curl \ - subversion \ - make \ - mono-devel \ - redhat-lsb-core \ - python-devel \ - java-1.8.0-openjdk \ - java-1.8.0-openjdk-devel \ - python-setuptools \ - python-six \ - python-wheel \ - pcre-devel which +############# +## SETUP ## +############# +RUN yum -y update \ +&& yum -y install yum-utils \ +&& yum -y install \ + wget git pkg-config make autoconf libtool zlib-devel gawk gcc-c++ curl subversion \ + redhat-lsb-core pcre-devel which \ + python-devel python-setuptools python-six python-wheel \ + java-1.8.0-openjdk java-1.8.0-openjdk-devel \ +&& yum clean all \ +&& rm -rf /var/cache/yum + +# Install dotnet +RUN rpm -Uvh "https://packages.microsoft.com/config/rhel/7/packages-microsoft-prod.rpm" \ +&& yum -y update \ +&& yum -y install dotnet-sdk-2.1 \ +&& yum clean all \ +&& rm -rf /var/cache/yum + +# Install Mono +#RUN rpm --import "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF" \ +#&& su -c 'curl https://download.mono-project.com/repo/centos7-stable.repo | tee /etc/yum.repos.d/mono-centos7-stable.repo' +#&& yum -y update \ +#&& yum -y install mono-devel + +# Install CMake +RUN wget "https://cmake.org/files/v3.8/cmake-3.8.2-Linux-x86_64.sh" \ +&& chmod 775 cmake-3.8.2-Linux-x86_64.sh \ +&& yes | ./cmake-3.8.2-Linux-x86_64.sh --prefix=/usr --exclude-subdir + +# Install Swig +RUN wget "https://downloads.sourceforge.net/project/swig/swig/swig-3.0.12/swig-3.0.12.tar.gz" \ +&& tar xvf swig-3.0.12.tar.gz \ +&& rm swig-3.0.12.tar.gz \ +&& cd swig-3.0.12 \ +&& ./configure --prefix=/usr \ +&& make -j 4 \ +&& make install \ +&& cd .. \ +&& rm -rf swig-3.0.12 ENV TZ=America/Los_Angeles RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone +################ +## OR-TOOLS ## +################ +ARG SRC_GIT_BRANCH +ENV SRC_GIT_BRANCH ${SRC_GIT_BRANCH:-master} +ARG SRC_GIT_SHA1 +ENV SRC_GIT_SHA1 ${SRC_GIT_SHA1:-unknown} + +# Download sources +# use SRC_GIT_SHA1 to modify the command +# i.e. avoid docker reusing the cache when new commit is pushed WORKDIR /root +RUN git clone -b "${SRC_GIT_BRANCH}" --single-branch https://github.com/google/or-tools \ +&& echo "sha1: $(cd or-tools && git rev-parse --verify HEAD)" \ +&& echo "expected sha1: ${SRC_GIT_SHA1}" -RUN wget "https://cmake.org/files/v3.8/cmake-3.8.2-Linux-x86_64.sh" - -RUN chmod 775 cmake-3.8.2-Linux-x86_64.sh - -RUN yes | ./cmake-3.8.2-Linux-x86_64.sh --prefix=/usr --exclude-subdir - -RUN wget "https://downloads.sourceforge.net/project/swig/swig/swig-3.0.12/swig-3.0.12.tar.gz" - -RUN tar xvf swig-3.0.12.tar.gz - -WORKDIR /root/swig-3.0.12 - -RUN ./configure --prefix=/usr - -RUN make -j 4 - -RUN make install - -WORKDIR /root - -RUN git clone -b "$SRC_GIT_BRANCH" --single-branch https://github.com/google/or-tools - +# Prebuild WORKDIR /root/or-tools - -RUN make third_party - -RUN easy_install wheel +RUN make detect && make third_party +RUN make detect_cc && make cc +RUN make detect_python && make python +RUN make detect_java && make java +RUN make detect_dotnet && make dotnet diff --git a/tools/docker/debian-9.Dockerfile b/tools/docker/debian-9.Dockerfile index 0f1637f2c59..95dbc9dfc5a 100644 --- a/tools/docker/debian-9.Dockerfile +++ b/tools/docker/debian-9.Dockerfile @@ -1,18 +1,62 @@ FROM debian:9 -ENV SRC_GIT_BRANCH master - -RUN apt-get update - -RUN apt-get -y install git wget autoconf libtool zlib1g-dev gawk g++ curl cmake subversion make mono-complete swig lsb-release python-dev default-jdk twine python-setuptools python-six python3-setuptools python3-dev python-wheel python3-wheel +############# +## SETUP ## +############# +RUN apt-get update -qq \ +&& apt-get install -qq \ + git pkg-config wget make cmake autoconf libtool zlib1g-dev gawk g++ curl subversion \ + swig lsb-release \ + python-dev python-wheel python-setuptools python-six \ + python3-dev python3-wheel python3-setuptools \ + default-jdk \ +&& apt-get clean \ +&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +# Dotnet Install +RUN apt-get update -qq \ +&& apt-get install -qq gpg apt-transport-https \ +&& wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.asc.gpg \ +&& mv microsoft.asc.gpg /etc/apt/trusted.gpg.d/ \ +&& wget -q https://packages.microsoft.com/config/debian/9/prod.list \ +&& mv prod.list /etc/apt/sources.list.d/microsoft-prod.list \ +&& apt-get update -qq \ +&& apt-get install -qq dotnet-sdk-2.1 \ +&& apt-get clean \ +&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +# Mono Install +#RUN apt-get install -qq apt-transport-https dirmngr \ +#&& apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF \ +#&& echo "deb https://download.mono-project.com/repo/debian stable-stretch main" | tee /etc/apt/sources.list.d/mono-official-stable.list \ +#&& apt-get update -qq \ +#&& apt-get install -qq mono-complete \ +#&& apt-get clean \ +#&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* ENV TZ=America/Los_Angeles RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone +################ +## OR-TOOLS ## +################ +ARG SRC_GIT_BRANCH +ENV SRC_GIT_BRANCH ${SRC_GIT_BRANCH:-master} +ARG SRC_GIT_SHA1 +ENV SRC_GIT_SHA1 ${SRC_GIT_SHA1:-unknown} + +# Download sources +# use SRC_GIT_SHA1 to modify the command +# i.e. avoid docker reusing the cache when new commit is pushed WORKDIR /root +RUN git clone -b "${SRC_GIT_BRANCH}" --single-branch https://github.com/google/or-tools \ +&& echo "sha1: $(cd or-tools && git rev-parse --verify HEAD)" \ +&& echo "expected sha1: ${SRC_GIT_SHA1}" -RUN git clone -b "$SRC_GIT_BRANCH" --single-branch https://github.com/google/or-tools - +# Prebuild WORKDIR /root/or-tools - -RUN make third_party +RUN make detect && make third_party +RUN make detect_cc && make cc +RUN make detect_python && make python +RUN make detect_java && make java +RUN make detect_dotnet && make dotnet diff --git a/tools/docker/manylinux1.Dockerfile b/tools/docker/manylinux1.Dockerfile index eda4c9aedaf..e7d46ad2bc2 100644 --- a/tools/docker/manylinux1.Dockerfile +++ b/tools/docker/manylinux1.Dockerfile @@ -1,10 +1,12 @@ FROM quay.io/pypa/manylinux1_x86_64:latest -ENV SRC_ROOT /root/src +ARG SRC_GIT_BRANCH +ENV SRC_GIT_BRANCH ${SRC_GIT_BRANCH:-master} + ENV BUILD_ROOT /root/build ENV EXPORT_ROOT /export ENV SRC_GIT_URL https://github.com/google/or-tools -ENV SRC_GIT_BRANCH master +ENV SRC_ROOT /root/src # The build of Python 2.6.x bindings is known to be broken. ENV SKIP_PLATFORMS "cp26-cp26m cp26-cp26mu" diff --git a/tools/docker/test/centos-7/cc.Dockerfile b/tools/docker/test/centos-7/cc.Dockerfile new file mode 100644 index 00000000000..348ca337034 --- /dev/null +++ b/tools/docker/test/centos-7/cc.Dockerfile @@ -0,0 +1,14 @@ +FROM centos:7 +LABEL maintainer="corentinl@google.com" + +RUN yum -y update \ +&& yum -y groupinstall 'Development Tools' \ +&& yum -y install which zlib-devel \ +&& yum clean all \ +&& rm -rf /var/cache/yum + +#ENV TZ=America/Los_Angeles +#RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +WORKDIR /root +ADD or-tools_centos-7_v*.tar.gz . diff --git a/tools/docker/test/centos-7/dotnet.Dockerfile b/tools/docker/test/centos-7/dotnet.Dockerfile new file mode 100644 index 00000000000..18975508524 --- /dev/null +++ b/tools/docker/test/centos-7/dotnet.Dockerfile @@ -0,0 +1,19 @@ +FROM centos:7 +LABEL maintainer="corentinl@google.com" + +RUN yum -y update \ +&& yum -y groupinstall 'Development Tools' \ +&& yum -y install which zlib-devel \ +&& yum clean all \ +&& rm -rf /var/cache/yum + +# Install dotnet +RUN rpm -Uvh "https://packages.microsoft.com/config/rhel/7/packages-microsoft-prod.rpm" \ +&& yum -y update \ +&& yum -y install dotnet-sdk-2.1 + +#ENV TZ=America/Los_Angeles +#RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +WORKDIR /root +ADD or-tools_centos-7_v*.tar.gz . diff --git a/tools/docker/test/centos-7/java.Dockerfile b/tools/docker/test/centos-7/java.Dockerfile new file mode 100644 index 00000000000..348ca337034 --- /dev/null +++ b/tools/docker/test/centos-7/java.Dockerfile @@ -0,0 +1,14 @@ +FROM centos:7 +LABEL maintainer="corentinl@google.com" + +RUN yum -y update \ +&& yum -y groupinstall 'Development Tools' \ +&& yum -y install which zlib-devel \ +&& yum clean all \ +&& rm -rf /var/cache/yum + +#ENV TZ=America/Los_Angeles +#RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +WORKDIR /root +ADD or-tools_centos-7_v*.tar.gz . diff --git a/tools/docker/test/debian-9/cc.Dockerfile b/tools/docker/test/debian-9/cc.Dockerfile new file mode 100644 index 00000000000..654a48253b2 --- /dev/null +++ b/tools/docker/test/debian-9/cc.Dockerfile @@ -0,0 +1,13 @@ +FROM debian:9 +LABEL maintainer="corentinl@google.com" + +RUN apt-get update \ +&& apt-get install -y -q build-essential zlib1g-dev \ +&& apt clean \ +&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +#ENV TZ=America/Los_Angeles +#RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +WORKDIR /root +ADD or-tools_debian-9_v*.tar.gz . diff --git a/tools/docker/test/debian-9/dotnet.Dockerfile b/tools/docker/test/debian-9/dotnet.Dockerfile new file mode 100644 index 00000000000..6c6fbed032b --- /dev/null +++ b/tools/docker/test/debian-9/dotnet.Dockerfile @@ -0,0 +1,25 @@ +FROM debian:9 +LABEL maintainer="corentinl@google.com" + +RUN apt-get update \ +&& apt-get install -y -q build-essential zlib1g-dev \ +&& apt clean \ +&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +# Install dotnet +RUN apt-get update -qq \ +&& apt-get install -qq apt-transport-https \ +&& wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.asc.gpg \ +&& mv microsoft.asc.gpg /etc/apt/trusted.gpg.d/ \ +&& wget -q https://packages.microsoft.com/config/debian/9/prod.list \ +&& mv prod.list /etc/apt/sources.list.d/microsoft-prod.list \ +&& apt-get update -qq \ +&& apt-get install -qq dotnet-sdk-2.1 \ +&& apt-get clean \ +&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +#ENV TZ=America/Los_Angeles +#RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +WORKDIR /root +ADD or-tools_debian-9_v*.tar.gz . diff --git a/tools/docker/test/debian-9/java.Dockerfile b/tools/docker/test/debian-9/java.Dockerfile new file mode 100644 index 00000000000..654a48253b2 --- /dev/null +++ b/tools/docker/test/debian-9/java.Dockerfile @@ -0,0 +1,13 @@ +FROM debian:9 +LABEL maintainer="corentinl@google.com" + +RUN apt-get update \ +&& apt-get install -y -q build-essential zlib1g-dev \ +&& apt clean \ +&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +#ENV TZ=America/Los_Angeles +#RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +WORKDIR /root +ADD or-tools_debian-9_v*.tar.gz . diff --git a/tools/docker/test/ubuntu-14.04/cc.Dockerfile b/tools/docker/test/ubuntu-14.04/cc.Dockerfile new file mode 100644 index 00000000000..4501c307a10 --- /dev/null +++ b/tools/docker/test/ubuntu-14.04/cc.Dockerfile @@ -0,0 +1,12 @@ +FROM ubuntu:14.04 + +RUN apt-get update \ +&& apt-get install -y -q build-essential zlib1g-dev \ +&& apt-get clean \ +&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +#ENV TZ=America/Los_Angeles +#RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +WORKDIR /root +ADD or-tools_ubuntu-14.04_v*.tar.gz . diff --git a/tools/docker/test/ubuntu-14.04/dotnet.Dockerfile b/tools/docker/test/ubuntu-14.04/dotnet.Dockerfile new file mode 100644 index 00000000000..485300aacd8 --- /dev/null +++ b/tools/docker/test/ubuntu-14.04/dotnet.Dockerfile @@ -0,0 +1,22 @@ +FROM ubuntu:14.04 + +RUN apt update \ +&& apt install -y -q build-essential zlib1g-dev \ +&& apt clean \ +&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +# Dotnet install +RUN apt-get update \ +&& wget -q https://packages.microsoft.com/config/ubuntu/14.04/packages-microsoft-prod.deb \ +&& dpkg -i packages-microsoft-prod.deb \ +&& apt-get install -qq apt-transport-https \ +&& apt-get update \ +&& apt-get install -qq dotnet-sdk-2.1 \ +&& apt-get clean \ +&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +#ENV TZ=America/Los_Angeles +#RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +WORKDIR /root +ADD or-tools_ubuntu-14.04_v*.tar.gz . diff --git a/tools/docker/test/ubuntu-14.04/java.Dockerfile b/tools/docker/test/ubuntu-14.04/java.Dockerfile new file mode 100644 index 00000000000..fdcf356c9b9 --- /dev/null +++ b/tools/docker/test/ubuntu-14.04/java.Dockerfile @@ -0,0 +1,12 @@ +FROM ubuntu:14.04 + +RUN apt update \ +&& apt install -y -q build-essential zlib1g-dev \ +&& apt clean \ +&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +#ENV TZ=America/Los_Angeles +#RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +WORKDIR /root +ADD or-tools_ubuntu-14.04_v*.tar.gz . diff --git a/tools/docker/test/ubuntu-16.04/cc.Dockerfile b/tools/docker/test/ubuntu-16.04/cc.Dockerfile new file mode 100644 index 00000000000..a87ed4cafac --- /dev/null +++ b/tools/docker/test/ubuntu-16.04/cc.Dockerfile @@ -0,0 +1,12 @@ +FROM ubuntu:16.04 + +RUN apt update \ +&& apt install -y -q build-essential zlib1g-dev \ +&& apt clean \ +&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +#ENV TZ=America/Los_Angeles +#RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +WORKDIR /root +ADD or-tools_ubuntu-16.04_v*.tar.gz . diff --git a/tools/docker/test/ubuntu-16.04/dotnet.Dockerfile b/tools/docker/test/ubuntu-16.04/dotnet.Dockerfile new file mode 100644 index 00000000000..26f41ff22dd --- /dev/null +++ b/tools/docker/test/ubuntu-16.04/dotnet.Dockerfile @@ -0,0 +1,22 @@ +FROM ubuntu:16.04 + +RUN apt update \ +&& apt install -y -q build-essential zlib1g-dev \ +&& apt clean \ +&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +# Dotnet install +RUN apt-get update \ +&& wget -q https://packages.microsoft.com/config/ubuntu/16.04/packages-microsoft-prod.deb \ +&& dpkg -i packages-microsoft-prod.deb \ +&& apt-get install -qq apt-transport-https \ +&& apt-get update \ +&& apt-get install -qq dotnet-sdk-2.1 \ +&& apt-get clean \ +&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +#ENV TZ=America/Los_Angeles +#RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +WORKDIR /root +ADD or-tools_ubuntu-16.04_v*.tar.gz . diff --git a/tools/docker/test/ubuntu-16.04/java.Dockerfile b/tools/docker/test/ubuntu-16.04/java.Dockerfile new file mode 100644 index 00000000000..a87ed4cafac --- /dev/null +++ b/tools/docker/test/ubuntu-16.04/java.Dockerfile @@ -0,0 +1,12 @@ +FROM ubuntu:16.04 + +RUN apt update \ +&& apt install -y -q build-essential zlib1g-dev \ +&& apt clean \ +&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +#ENV TZ=America/Los_Angeles +#RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +WORKDIR /root +ADD or-tools_ubuntu-16.04_v*.tar.gz . diff --git a/tools/docker/test/ubuntu-17.10/cc.Dockerfile b/tools/docker/test/ubuntu-17.10/cc.Dockerfile new file mode 100644 index 00000000000..44d8eb1fe91 --- /dev/null +++ b/tools/docker/test/ubuntu-17.10/cc.Dockerfile @@ -0,0 +1,12 @@ +FROM ubuntu:17.10 + +RUN apt update \ +&& apt install -y -q build-essential zlib1g-dev \ +&& apt clean \ +&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +#ENV TZ=America/Los_Angeles +#RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +WORKDIR /root +ADD or-tools_ubuntu-17.10_v*.tar.gz . diff --git a/tools/docker/test/ubuntu-17.10/dotnet.Dockerfile b/tools/docker/test/ubuntu-17.10/dotnet.Dockerfile new file mode 100644 index 00000000000..ca0aea2b42d --- /dev/null +++ b/tools/docker/test/ubuntu-17.10/dotnet.Dockerfile @@ -0,0 +1,22 @@ +FROM ubuntu:17.10 + +RUN apt update \ +&& apt install -y -q build-essential zlib1g-dev \ +&& apt clean \ +&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +# Dotnet install +RUN apt-get update \ +&& wget -q https://packages.microsoft.com/config/ubuntu/17.10/packages-microsoft-prod.deb \ +&& dpkg -i packages-microsoft-prod.deb \ +&& apt-get install -qq apt-transport-https \ +&& apt-get update \ +&& apt-get install -qq dotnet-sdk-2.1 \ +&& apt-get clean \ +&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +#ENV TZ=America/Los_Angeles +#RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +WORKDIR /root +ADD or-tools_ubuntu-17.10_v*.tar.gz . diff --git a/tools/docker/test/ubuntu-17.10/java.Dockerfile b/tools/docker/test/ubuntu-17.10/java.Dockerfile new file mode 100644 index 00000000000..44d8eb1fe91 --- /dev/null +++ b/tools/docker/test/ubuntu-17.10/java.Dockerfile @@ -0,0 +1,12 @@ +FROM ubuntu:17.10 + +RUN apt update \ +&& apt install -y -q build-essential zlib1g-dev \ +&& apt clean \ +&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +#ENV TZ=America/Los_Angeles +#RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +WORKDIR /root +ADD or-tools_ubuntu-17.10_v*.tar.gz . diff --git a/tools/docker/test/ubuntu-18.04/cc.Dockerfile b/tools/docker/test/ubuntu-18.04/cc.Dockerfile new file mode 100644 index 00000000000..83476a98bc6 --- /dev/null +++ b/tools/docker/test/ubuntu-18.04/cc.Dockerfile @@ -0,0 +1,12 @@ +FROM ubuntu:18.04 + +RUN apt update \ +&& apt install -y -q build-essential zlib1g-dev \ +&& apt clean \ +&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +#ENV TZ=America/Los_Angeles +#RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +WORKDIR /root +ADD or-tools_ubuntu-18.04_v*.tar.gz . diff --git a/tools/docker/test/ubuntu-18.04/dotnet.Dockerfile b/tools/docker/test/ubuntu-18.04/dotnet.Dockerfile new file mode 100644 index 00000000000..f15084e4c10 --- /dev/null +++ b/tools/docker/test/ubuntu-18.04/dotnet.Dockerfile @@ -0,0 +1,24 @@ +FROM ubuntu:18.04 + +RUN apt update \ +&& apt install -y -q build-essential zlib1g-dev \ +&& apt clean \ +&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +# Dotnet install +RUN apt-get update -qq \ +&& apt-get install gpg apt-transport-https \ +&& wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.asc.gpg \ +&& mv microsoft.asc.gpg /etc/apt/trusted.gpg.d/ \ +&& wget -q https://packages.microsoft.com/config/ubuntu/18.04/prod.list \ +&& mv prod.list /etc/apt/sources.list.d/microsoft-prod.list \ +&& apt-get update -qq \ +&& apt-get install dotnet-sdk-2.1 \ +&& apt clean \ +&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +#ENV TZ=America/Los_Angeles +#RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +WORKDIR /root +ADD or-tools_ubuntu-18.04_v*.tar.gz . diff --git a/tools/docker/test/ubuntu-18.04/java.Dockerfile b/tools/docker/test/ubuntu-18.04/java.Dockerfile new file mode 100644 index 00000000000..93681687cf5 --- /dev/null +++ b/tools/docker/test/ubuntu-18.04/java.Dockerfile @@ -0,0 +1,14 @@ +FROM ubuntu:18.04 + +RUN apt update \ +&& apt install -y -q \ + build-essential zlib1g-dev \ + default-jdk \ +&& apt clean \ +&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +#ENV TZ=America/Los_Angeles +#RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +WORKDIR /root +ADD or-tools_ubuntu-18.04_v*.tar.gz . diff --git a/tools/docker/ubuntu-14.04.Dockerfile b/tools/docker/ubuntu-14.04.Dockerfile index 71f821fd6f4..9c314e535bf 100644 --- a/tools/docker/ubuntu-14.04.Dockerfile +++ b/tools/docker/ubuntu-14.04.Dockerfile @@ -1,43 +1,65 @@ FROM ubuntu:14.04 -ENV SRC_GIT_BRANCH master - -RUN apt-get update - -RUN apt-get -y install wget - -RUN wget "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF" -O out && apt-key add out && rm out - -RUN echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list - -RUN apt-get update - -RUN apt-get -y install git autoconf libtool zlib1g-dev gawk g++ curl subversion make mono-complete lsb-release python-dev default-jdk python-setuptools python-six python3-setuptools python3-dev libpcre3-dev python-wheel python3-wheel - -WORKDIR /root - -RUN wget "https://cmake.org/files/v3.8/cmake-3.8.2-Linux-x86_64.sh" - -RUN chmod 775 cmake-3.8.2-Linux-x86_64.sh - -RUN yes | ./cmake-3.8.2-Linux-x86_64.sh --prefix=/usr --exclude-subdir - -RUN wget "https://downloads.sourceforge.net/project/swig/swig/swig-3.0.12/swig-3.0.12.tar.gz" - -RUN tar xvf swig-3.0.12.tar.gz - -WORKDIR /root/swig-3.0.12 - -RUN ./configure --prefix=/usr - -RUN make -j 4 - -RUN make install - +############# +## SETUP ## +############# +RUN apt-get update \ +&& apt-get install -qq \ + git pkg-config wget make cmake3 autoconf libtool zlib1g-dev gawk g++ curl subversion lsb-release libpcre3-dev \ + python-dev python-wheel python-setuptools python-six \ + python3-dev python3-wheel python3-setuptools \ + default-jdk \ +&& apt-get clean \ +&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +# Dotnet Install +# note: package "apt-transport-https" is needed by deb command see below +RUN apt-get update \ +&& wget -q https://packages.microsoft.com/config/ubuntu/14.04/packages-microsoft-prod.deb \ +&& dpkg -i packages-microsoft-prod.deb \ +&& apt-get install -qq apt-transport-https \ +&& apt-get update \ +&& apt-get install -qq dotnet-sdk-2.1 \ +&& apt-get clean \ +&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +## Mono Install +#RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF \ +#&& echo "deb https://download.mono-project.com/repo/ubuntu stable-trusty main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list \ +#&& apt-get update \ +#&& apt-get install -qq mono-complete \ +#&& apt-get clean \ +#&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +# Swig install +RUN wget "https://downloads.sourceforge.net/project/swig/swig/swig-3.0.12/swig-3.0.12.tar.gz" \ +&& tar xvf swig-3.0.12.tar.gz && rm swig-3.0.12.tar.gz \ +&& cd swig-3.0.12 && ./configure --prefix=/usr && make -j 4 && make install \ +&& cd .. && rm -rf swig-3.0.12 + +ENV TZ=America/Los_Angeles +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +################ +## OR-TOOLS ## +################ +ARG SRC_GIT_BRANCH +ENV SRC_GIT_BRANCH ${SRC_GIT_BRANCH:-master} +ARG SRC_GIT_SHA1 +ENV SRC_GIT_SHA1 ${SRC_GIT_SHA1:-unknown} + +# Download sources +# use SRC_GIT_SHA1 to modify the command +# i.e. avoid docker reusing the cache when new commit is pushed WORKDIR /root +RUN git clone -b "${SRC_GIT_BRANCH}" --single-branch https://github.com/google/or-tools \ +&& echo "sha1: $(cd or-tools && git rev-parse --verify HEAD)" \ +&& echo "expected sha1: ${SRC_GIT_SHA1}" -RUN git clone -b "$SRC_GIT_BRANCH" --single-branch https://github.com/google/or-tools - +# Prebuild WORKDIR /root/or-tools - -RUN make third_party +RUN make detect && make third_party +RUN make detect_cc && make cc +RUN make detect_python && make python +RUN make detect_java && make java +RUN make detect_dotnet && make dotnet diff --git a/tools/docker/ubuntu-16.04.Dockerfile b/tools/docker/ubuntu-16.04.Dockerfile index 239986c9eba..8ce2377ce65 100644 --- a/tools/docker/ubuntu-16.04.Dockerfile +++ b/tools/docker/ubuntu-16.04.Dockerfile @@ -1,18 +1,57 @@ FROM ubuntu:16.04 -ENV SRC_GIT_BRANCH master - -RUN apt-get update - -RUN apt-get -y install git wget autoconf libtool zlib1g-dev gawk g++ curl cmake subversion make mono-complete swig lsb-release python-dev default-jdk twine python-setuptools python-six python3-setuptools python3-dev python-wheel python3-wheel +############# +## SETUP ## +############# +RUN apt update \ +&& apt install -y -q \ +git pkg-config wget make cmake autoconf libtool zlib1g-dev gawk g++ curl subversion \ +swig lsb-release \ +python-dev python-wheel python-setuptools python-six \ +python3-dev python3-wheel python3-setuptools \ +default-jdk \ +&& apt clean \ +&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +# Dotnet Install +RUN apt-get update \ +&& wget -q https://packages.microsoft.com/config/ubuntu/16.04/packages-microsoft-prod.deb \ +&& dpkg -i packages-microsoft-prod.deb \ +&& apt-get install -qq apt-transport-https \ +&& apt-get update \ +&& apt-get install -qq dotnet-sdk-2.1 \ +&& apt-get clean \ +&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +## Mono Install +#RUN apt-get update \ +#&& apt-get install -qq mono-complete \ +#&& apt-get clean \ +#&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* ENV TZ=America/Los_Angeles RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone +################ +## OR-TOOLS ## +################ +ARG SRC_GIT_BRANCH +ENV SRC_GIT_BRANCH ${SRC_GIT_BRANCH:-master} +ARG SRC_GIT_SHA1 +ENV SRC_GIT_SHA1 ${SRC_GIT_SHA1:-unknown} + +# Download sources +# use SRC_GIT_SHA1 to modify the command +# i.e. avoid docker reusing the cache when new commit is pushed WORKDIR /root +RUN git clone -b "${SRC_GIT_BRANCH}" --single-branch https://github.com/google/or-tools \ +&& echo "sha1: $(cd or-tools && git rev-parse --verify HEAD)" \ +&& echo "expected sha1: ${SRC_GIT_SHA1}" -RUN git clone -b "$SRC_GIT_BRANCH" --single-branch https://github.com/google/or-tools - +# Prebuild WORKDIR /root/or-tools - -RUN make third_party +RUN make detect && make third_party +RUN make detect_cc && make cc +RUN make detect_python && make python +RUN make detect_java && make java +RUN make detect_dotnet && make dotnet diff --git a/tools/docker/ubuntu-17.10.Dockerfile b/tools/docker/ubuntu-17.10.Dockerfile index a422422d259..f6ad3d03011 100644 --- a/tools/docker/ubuntu-17.10.Dockerfile +++ b/tools/docker/ubuntu-17.10.Dockerfile @@ -1,18 +1,57 @@ FROM ubuntu:17.10 -ENV SRC_GIT_BRANCH master - -RUN apt-get update - -RUN apt-get -y install git wget autoconf libtool zlib1g-dev gawk g++ curl cmake subversion make mono-complete swig lsb-release python-dev default-jdk twine python-setuptools python-six python3-setuptools python3-dev python-wheel python3-wheel +############# +## SETUP ## +############# +RUN apt update \ +&& apt install -y -q \ + git pkg-config wget make cmake autoconf libtool zlib1g-dev gawk g++ curl subversion \ + swig lsb-release \ + python-dev python-wheel python-setuptools python-six \ + python3-dev python3-wheel python3-setuptools \ + default-jdk \ +&& apt clean \ +&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +# Dotnet Install +RUN apt-get update \ +&& wget -q https://packages.microsoft.com/config/ubuntu/17.10/packages-microsoft-prod.deb \ +&& dpkg -i packages-microsoft-prod.deb \ +&& apt-get install -qq apt-transport-https \ +&& apt-get update \ +&& apt-get install -qq dotnet-sdk-2.1 \ +&& apt-get clean \ +&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +## Mono Install +#RUN apt-get update \ +#&& apt-get install -qq mono-complete \ +#&& apt-get clean \ +#&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* ENV TZ=America/Los_Angeles RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone +################ +## OR-TOOLS ## +################ +ARG SRC_GIT_BRANCH +ENV SRC_GIT_BRANCH ${SRC_GIT_BRANCH:-master} +ARG SRC_GIT_SHA1 +ENV SRC_GIT_SHA1 ${SRC_GIT_SHA1:-unknown} + +# Download sources +# use SRC_GIT_SHA1 to modify the command +# i.e. avoid docker reusing the cache when new commit is pushed WORKDIR /root +RUN git clone -b "${SRC_GIT_BRANCH}" --single-branch https://github.com/google/or-tools \ +&& echo "sha1: $(cd or-tools && git rev-parse --verify HEAD)" \ +&& echo "expected sha1: ${SRC_GIT_SHA1}" -RUN git clone -b "$SRC_GIT_BRANCH" --single-branch https://github.com/google/or-tools - +# Prebuild WORKDIR /root/or-tools - -RUN make third_party +RUN make detect && make third_party +RUN make detect_cc && make cc +RUN make detect_python && make python +RUN make detect_java && make java +RUN make detect_dotnet && make dotnet diff --git a/tools/docker/ubuntu-18.04.Dockerfile b/tools/docker/ubuntu-18.04.Dockerfile new file mode 100644 index 00000000000..304aa2992bf --- /dev/null +++ b/tools/docker/ubuntu-18.04.Dockerfile @@ -0,0 +1,59 @@ +FROM ubuntu:18.04 + +############# +## SETUP ## +############# +RUN apt update \ +&& apt install -y -q \ + git pkg-config wget make cmake autoconf libtool zlib1g-dev gawk g++ curl subversion \ + swig lsb-release \ + python-dev python-wheel python-setuptools python-six \ + python3-dev python3-wheel python3-setuptools \ + default-jdk \ +&& apt clean \ +&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +# Dotnet Install +RUN apt-get update -qq \ +&& apt-get install -y -q gpg apt-transport-https \ +&& wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.asc.gpg \ +&& mv microsoft.asc.gpg /etc/apt/trusted.gpg.d/ \ +&& wget -q https://packages.microsoft.com/config/ubuntu/18.04/prod.list \ +&& mv prod.list /etc/apt/sources.list.d/microsoft-prod.list \ +&& apt-get update -qq \ +&& apt-get install -y -q dotnet-sdk-2.1 \ +&& apt clean \ +&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +## Mono Install +#RUN apt-get update \ +#&& apt-get install -qq mono-complete \ +#&& apt-get clean \ +#&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +ENV TZ=America/Los_Angeles +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +################ +## OR-TOOLS ## +################ +ARG SRC_GIT_BRANCH +ENV SRC_GIT_BRANCH ${SRC_GIT_BRANCH:-master} +ARG SRC_GIT_SHA1 +ENV SRC_GIT_SHA1 ${SRC_GIT_SHA1:-unknown} + +# Download sources +# use SRC_GIT_SHA1 to modify the command +# i.e. avoid docker reusing the cache when new commit is pushed +WORKDIR /root +RUN git clone -b "${SRC_GIT_BRANCH}" --single-branch https://github.com/google/or-tools \ +&& echo "sha1: $(cd or-tools && git rev-parse --verify HEAD)" \ +&& echo "expected sha1: ${SRC_GIT_SHA1}" + +# Prebuild +WORKDIR /root/or-tools +RUN make detect && make third_party +RUN make detect_cc && make cc +RUN make detect_python && make python +RUN make detect_java && make java +RUN make detect_dotnet && make dotnet