mirror of
https://github.com/trailofbits/algo.git
synced 2025-04-11 11:47:08 +02:00
Docker makefile (#1553)
* makefile for docker deploys * update docs for makefile
This commit is contained in:
parent
655729ef54
commit
fe19859b00
2 changed files with 46 additions and 0 deletions
39
Makefile
Normal file
39
Makefile
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
## docker-build: Build and tag a docker image
|
||||||
|
.PHONY: docker-build
|
||||||
|
|
||||||
|
IMAGE := trailofbits/algo
|
||||||
|
TAG := latest
|
||||||
|
DOCKERFILE := Dockerfile
|
||||||
|
CONFIGURATIONS := $(shell pwd)
|
||||||
|
|
||||||
|
docker-build:
|
||||||
|
docker build \
|
||||||
|
-t $(IMAGE):$(TAG) \
|
||||||
|
-f $(DOCKERFILE) \
|
||||||
|
.
|
||||||
|
|
||||||
|
## docker-deploy: Mount config directory and deploy Algo
|
||||||
|
.PHONY: docker-deploy
|
||||||
|
|
||||||
|
# '--rm' flag removes the container when finished.
|
||||||
|
docker-deploy:
|
||||||
|
docker run \
|
||||||
|
--cap-drop=all \
|
||||||
|
--rm \
|
||||||
|
-it \
|
||||||
|
-v $(CONFIGURATIONS):/data \
|
||||||
|
$(IMAGE):$(TAG)
|
||||||
|
|
||||||
|
## docker-clean: Remove images and containers.
|
||||||
|
.PHONY: docker-prune
|
||||||
|
|
||||||
|
docker-prune:
|
||||||
|
docker images \
|
||||||
|
$(IMAGE) |\
|
||||||
|
awk '{if (NR>1) print $$3}' |\
|
||||||
|
xargs docker rmi
|
||||||
|
|
||||||
|
## docker-all: Build, Deploy, Prune
|
||||||
|
.PHONY: docker-all
|
||||||
|
|
||||||
|
docker-all: docker-build docker-deploy docker-prune
|
|
@ -46,6 +46,13 @@ $ docker run --cap-drop=all -it \
|
||||||
trailofbits/algo:latest
|
trailofbits/algo:latest
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## GNU Makefile for Docker
|
||||||
|
|
||||||
|
You can also build and deploy with a Makefile. This simplifies some of the command strings and opens the door for further user configuration.
|
||||||
|
|
||||||
|
The `Makefile` consists of three targets: `docker-build`, `docker-deploy`, and `docker-prune`.
|
||||||
|
`docker-all` will run thru all of them.
|
||||||
|
|
||||||
## Building Your Own Docker Image
|
## Building Your Own Docker Image
|
||||||
|
|
||||||
You can use the Dockerfile provided in this repository as-is, or modify it to suit your needs. Further instructions on building an image can be found in the [Docker engine](https://docs.docker.com/engine/) documents.
|
You can use the Dockerfile provided in this repository as-is, or modify it to suit your needs. Further instructions on building an image can be found in the [Docker engine](https://docs.docker.com/engine/) documents.
|
||||||
|
|
Loading…
Add table
Reference in a new issue