-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
109 lines (90 loc) · 3.89 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/usr/bin/make -f
###############################################################################
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
###############################################################################
DOCKER_REPO_HOST := docker.apache.org
DOCKER_REPO_GROUP := ofbiz
BF_DOCKER_BUILD = docker build -t $(DOCKER_REPO_HOST)/$(DOCKER_REPO_GROUP)/$@ $@
ROOTS := $(patsubst roots/%/Dockerfile,%,$(wildcard roots/*/Dockerfile))
STANDARD_IMAGES := docker-base ofbiz-localdev-base ofbiz-postgresql ofbiz-mysql
ALL_IMAGES := apt-cacher $(STANDARD_IMAGES)
default: standard
standard: $(STANDARD_IMAGES)
.PHONY: $(STANDARD_IMAGES) $(EXTRA_IMAGES)
docker-base: start-apt-cacher
ofbiz-localdev-base: docker-base
ofbiz-mysql: ofbiz-localdev-base
ofbiz-postgresql: ofbiz-localdev-base
.PHONY: apt-cacher
apt-cacher: %: %/Dockerfile.in
set -x; ( \
sed -e "s,@@DockerBase@@,$(DOCKER_REPO_HOST)/$(DOCKER_REPO_GROUP),g" | \
if [ "x$(http_proxy)" = "x" ]; then \
sed -e "s,@@GlobalProxyEnv@@,,g"; \
else \
sed -e "s,@@GlobalProxyEnv@@,ENV http_proxy $(http_proxy),g"; \
fi; \
) < $*/Dockerfile.in > $*/Dockerfile.new
mv $*/Dockerfile.new $*/Dockerfile
docker build -t $(DOCKER_REPO_HOST)/$(DOCKER_REPO_GROUP)/$@ $@
$(STANDARD_IMAGES): %: %/Dockerfile.in
set -x;sed \
-e "s,@@DockerBase@@,$(DOCKER_REPO_HOST)/$(DOCKER_REPO_GROUP),g" \
-e "s,@@AptCacherAddress@@,`docker inspect ofbiz-apt-cacher|sed -n 's,.*\"IPAddress\": \"\(.*\)\".*,\1,p'`," \
< $*/Dockerfile.in > $*/Dockerfile.new
mv $*/Dockerfile.new $*/Dockerfile
docker build -t $(DOCKER_REPO_HOST)/$(DOCKER_REPO_GROUP)/$@ $@
$(patsubst %,roots/%/root.tar.xz,$(ROOTS)): roots/%/root.tar.xz: roots/build.%.tar
xz < $< > [email protected]
mv [email protected] $@
#.PHONY: $(patsubst %,roots/%.tar,$(ROOTS))
tarballs: $(patsubst %,roots/build.%.tar,$(ROOTS))
$(patsubst %,roots/build.%.tar,$(ROOTS)): TARGET=$(CURDIR)/roots/build.$*.debootstrap
$(patsubst %,roots/build.%.tar,$(ROOTS)): roots/build.%.tar:
@mkdir -p $(@D)
@rm -rf "$(TARGET)"
roots/debootstrap "$*" "$(TARGET)" "$@"
roots: $(patsubst %,roots-%,$(ROOTS))
.PHONY: $(patsubst %,roots-%,$(ROOTS))
$(patsubst %,roots-%,$(ROOTS)): roots-%: roots/%/root.tar.xz
docker build -t $(DOCKER_REPO_HOST)/$(DOCKER_REPO_GROUP)/debootstrap-$* roots/$*
start-apt-cacher: apt-cacher
docker run -d --name ofbiz-apt-cacher $(DOCKER_REPO_HOST)/$(DOCKER_REPO_GROUP)/apt-cacher || true
stop-apt-cacher: apt-cacher
docker rm -f ofbiz-apt-cacher 2>/dev/null || true
pristine.apt-cacher: stop-apt-cacher
rm -f apt-cacher/Dockerfile
clean.dockerfiles:
rm -f $(patsubst %,%/Dockerfile,$(STANDARD_IMAGES))
clean: clean.dockerfiles
rm -rf roots/build.*.debootstrap
rm -rf roots/*/root.tar.xz.new
rm -f ofbiz-localdev-base/wp-cli.phar
pristine: clean pristine.apt-cacher
rm -f roots/*/root.tar*
rm -rf roots/build.*.tar*
freshen:
pristine: pristine.apt-cacher
pristine: pristine.ofbiz-backend.wp-cli
pristine.ofbiz-backend.wp-cli:
rm -f ofbiz-localdev-base/wp-cli.phar ofbiz-localdev-base/wp-cli.phar.new
freshen: ofbiz-localdev-base/wp-cli.phar
ofbiz-localdev-base/wp-cli.phar:
wget -O [email protected] https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
mv [email protected] $@
.PHONY: ofbiz-backend/wp-cli.phar