-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
52 lines (43 loc) · 2.02 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
version = $(shell awk '/^version/' Cargo.toml | head -n1 | cut -d "=" -f 2 | sed 's: ::g')
release := "1"
uniq := $(shell head -c1000 /dev/urandom | sha512sum | head -c 12 ; echo ;)
cidfile := "/tmp/.tmp.docker.$(uniq)"
build_type := release
all:
mkdir -p build/ && \
cp Dockerfile.build.ubuntu18.04 build/Dockerfile && \
cp -a Cargo.toml src scripts templates Makefile build/ && \
cd build/ && \
docker build -t security_log_analysis_rust/build_rust:ubuntu18.04 . && \
cd ../ && \
rm -rf build/
cleanup:
docker rmi `docker images | python -c "import sys; print('\n'.join(l.split()[2] for l in sys.stdin if '<none>' in l))"`
rm -rf /tmp/.tmp.docker.security_log_analysis_rust
rm Dockerfile
package:
docker run --cidfile $(cidfile) -v `pwd`/target:/security_log_analysis_rust/target security_log_analysis_rust/build_rust:ubuntu18.04 \
/security_log_analysis_rust/scripts/build_deb_docker.sh $(version) $(release)
docker cp `cat $(cidfile)`:/security_log_analysis_rust/security-log-analysis-rust_$(version)-$(release)_amd64.deb .
docker rm `cat $(cidfile)`
rm $(cidfile)
test:
docker run --cidfile $(cidfile) -v `pwd`/target:/security_log_analysis_rust/target security_log_analysis_rust/build_rust:ubuntu18.04 /bin/bash -c ". ~/.cargo/env && cargo test"
build_test:
cp Dockerfile.test.ubuntu18.04 build/Dockerfile && \
cd build/ && \
docker build -t security_log_analysis_rust/test_rust:ubuntu18.04 . && \
cd ../ && \
rm -rf build/
install:
cp target/$(build_type)/security-log-parse-rust /usr/bin/security-log-parse-rust
cp target/$(build_type)/security-log-http /usr/bin/security-log-http
pull:
`aws ecr --region us-east-1 get-login --no-include-email`
docker pull 281914939654.dkr.ecr.us-east-1.amazonaws.com/rust_stable:latest
docker tag 281914939654.dkr.ecr.us-east-1.amazonaws.com/rust_stable:latest rust_stable:latest
docker rmi 281914939654.dkr.ecr.us-east-1.amazonaws.com/rust_stable:latest
dev:
docker run -it --rm -v `pwd`:/security_log_analysis_rust rust_stable:latest /bin/bash || true
get_version:
echo $(version)