Fill out Makefile

This commit is contained in:
Radon Rosborough 2020-12-22 20:19:22 -08:00
parent e8a56ec33c
commit da605793c6
5 changed files with 86 additions and 11 deletions

7
.dockerignore Normal file
View File

@ -0,0 +1,7 @@
# This file is generated by 'make dockerignore', do not edit.
**/*.log
**/.env
**/.terraform
**/debs
**/node_modules
**/work

View File

@ -1,20 +1,40 @@
SHELL := bash
.SHELLFLAGS := -o pipefail -euc
export PATH := bin:$(PATH)
.PHONY: debug
debug:
node builder/build.js python
include .env
export
.PHONY: help
help:
@echo "usage:"
@echo
@cat Makefile | \
grep -E '[.]PHONY|[#]##' | \
sed -E 's/[.]PHONY: */ make /' | \
sed -E 's/[#]## *(.+)/\n (\1)\n/'
### Build things locally
.PHONY: packaging-image
packaging-image:
docker build . -f docker/packaging/Dockerfile -t riju:packaging
docker build . -f docker/packaging/Dockerfile -t riju-packaging --pull
.PHONY: runtime-image
runtime-image:
docker build . -f docker/runtime/Dockerfile -t riju:runtime
docker build . -f docker/runtime/Dockerfile -t riju-runtime --pull
.PHONY: app-image
app-image:
docker build . -f docker/app/Dockerfile -t riju:app
docker build . -f docker/app/Dockerfile -t riju-app --pull
.PHONY: pkg
pkg:
@: $${L}
node src/packager/main.js --lang $(L)
### Run things inside Docker
.PHONY: packaging-shell
packaging-shell:
@ -24,6 +44,54 @@ packaging-shell:
runtime-shell:
docker run -it --rm -v $(PWD):/src riju:runtime
.PHONY: pkg
pkg:
node src/packager/main.js --lang $(LANG)
### Fetch things from registries
.PHONY: fetch-packaging-image
fetch-packaging-image:
docker pull $(DOCKER_REPO_BASE)-packaging
docker tag $(DOCKER_REPO_BASE)-packaging riju-packaging
.PHONY: fetch-runtime-image
fetch-runtime-image:
docker pull $(DOCKER_REPO_BASE)-runtime
docker tag $(DOCKER_REPO_BASE)-runtime riju-runtime
.PHONY: fetch-app-image
fetch-app-image:
docker pull $(DOCKER_REPO_BASE)-app
docker tag $(DOCKER_REPO_BASE)-app riju-app
.PHONY: fetch-pkg
fetch-pkg:
@: $${L}
mkdir -p debs
aws s3 cp s3://$(S3_BUCKET_BASE)-debs/debs/$(L).deb debs/$(L).deb
### Publish things to registries
.PHONY: publish-packaging-image
publish-packaging-image:
docker tag riju-packaging $(DOCKER_REPO_BASE)-packaging
docker push $(DOCKER_REPO_BASE)-packaging
.PHONY: publish-runtime-image
publish-runtime-image:
docker tag riju-runtime $(DOCKER_REPO_BASE)-runtime
docker push $(DOCKER_REPO_BASE)-runtime
.PHONY: publish-app-image
publish-app-image:
docker tag riju-app $(DOCKER_REPO_BASE)-app
docker push $(DOCKER_REPO_BASE)-app
.PHONY: publish-pkg
publish-pkg:
@: $${L}
aws s3 cp debs/$(L).deb s3://$(S3_BUCKET_BASE)-debs/debs/$(L).deb
### Miscellaneous
.PHONY: dockerignore
dockerignore:
echo "# This file is generated by 'make dockerignore', do not edit." > .dockerignore
cat .gitignore | sed 's#^#**/#' >> .dockerignore

View File

@ -1,9 +1,9 @@
FROM ubuntu:rolling
COPY docker/scripts/build/install.bash /tmp/
COPY docker/packaging/install.bash /tmp/
RUN /tmp/install.bash
WORKDIR /src
COPY docker/scripts/build/pid1.bash /usr/local/sbin/
COPY docker/packaging/pid1.bash /usr/local/sbin/
ENTRYPOINT ["/usr/local/sbin/pid1.bash"]
CMD ["bash"]