aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2020-01-28 01:09:00 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2020-01-28 01:09:00 +0300
commit0abecd6d6485bbfa94f9489dbf9dc5e21574f849 (patch)
tree38d49132c45cf4432992ffaca79ff71b9da17ad5
parentTravis: switch to make (diff)
downloadfr24feed-0abecd6d6485bbfa94f9489dbf9dc5e21574f849.tar.gz
fr24feed-0abecd6d6485bbfa94f9489dbf9dc5e21574f849.zip
add safety checks to Makefile
-rw-r--r--.travis.yml2
-rw-r--r--Makefile37
-rw-r--r--README.md4
3 files changed, 31 insertions, 12 deletions
diff --git a/.travis.yml b/.travis.yml
index 3259496..6c39fe7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -28,7 +28,7 @@ jobs:
if [ "$TRAVIS_BRANCH" = master ]; then
make login && make builder/create && make push
else
- make builder/create && make build
+ make builder/create && make buildx
fi
- name: Build native images using Compose
script: sudo make install-compose && make compose-build
diff --git a/Makefile b/Makefile
index e5e52ad..2a1e3a2 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,6 @@
+# Various one-liners which I'm too lazy to remember.
+# Basically a collection of really small shell scripts.
+
PROJECT = fr24feed
# Use BuildKit, which is required:
export DOCKER_BUILDKIT = 1
@@ -37,12 +40,18 @@ binfmt: fix-binfmt
# Dockerfile's, create a manifest manually, etc.), so it's only here for
# testing purposes, and native builds.
docker-build/%:
+ifndef FORCE
+ $(warning Consider using `docker buildx` instead)
+endif
docker build -t "$(DOCKER_USERNAME)/$*" "$*/"
docker-build: docker-build/dump1090 docker-build/fr24feed
# `docker-compose build` has the same problems as `docker build`.
compose-build:
+ifndef FORCE
+ $(warning Consider using `docker buildx` instead)
+endif
docker-compose build
# The simple way to build multiarch repos.
@@ -57,19 +66,29 @@ buildx/%:
buildx: buildx/dump1090 buildx/fr24feed
-# buildx is used by default.
-build: buildx
+# Build natively by default.
+build: compose-build
# `docker push` would replace the multiarch repo with a single image by default
# (you'd have to create a manifest and push it instead), so it's only here for
# testing purposes.
-docker-push/%: docker-build/%
+check-docker-push:
+ifndef FORCE
+ $(error Please do not use `docker push`)
+endif
+
+docker-push/%: check-docker-push docker-build/%
docker push "$(DOCKER_USERNAME)/$*"
-docker-push: docker-push/dump1090 docker-push/fr24feed
+docker-push: check-docker-push docker-push/dump1090 docker-push/fr24feed
# `docker-compose push` has the same problems as `docker push`.
-compose-push: compose-build
+check-compose-push:
+ifndef FORCE
+ $(error Please do not use `docker-compose push`)
+endif
+
+compose-push: check-compose-push compose-build
docker-compose push
# The simple way to push multiarch repos.
@@ -81,16 +100,16 @@ buildx-push: buildx-push/dump1090 buildx-push/fr24feed
# buildx is used by default.
push: buildx-push
+pull:
+ docker-compose pull
+
up:
docker-compose up -d
down:
docker-compose down --volumes
-pull:
- docker-compose pull
-
clean:
docker system prune --all --force --volumes
-.PHONY: all login install-compose compose fix-binfmt binfmt docker-build compose-build builder/create builder/rm buildx build docker-push compose-push buildx-push push up down pull clean
+.PHONY: all login install-compose compose fix-binfmt binfmt docker-build compose-build builder/create builder/rm buildx build check-docker-push docker-push check-compose-push compose-push buildx-push push pull up down clean
diff --git a/README.md b/README.md
index 72c4d5a..d1c8c5d 100644
--- a/README.md
+++ b/README.md
@@ -68,8 +68,8 @@ The approach is to use Docker's new BuildKit builder + the buildx command line
plugin.
Other possibilities are:
-* use QEMU + multiarch base images directly ([2][2], [3][3]), and create a manifest file
-manually,
+* use QEMU + multiarch base images directly ([2][2], [3][3]), and create a
+manifest file manually,
* build natively on multiple architectures (not sure how to combine them in a
single manifest then though).