-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbuild_docker.sh
More file actions
executable file
·67 lines (61 loc) · 1.8 KB
/
Copy pathbuild_docker.sh
File metadata and controls
executable file
·67 lines (61 loc) · 1.8 KB
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
#! /usr/bin/env bash
set -e
printf "Building docker container for HARDENS\n"
# Check usage -- naive for simplicity
Usage="Usage: ./build-docker.sh [-p|--push]"
doTest=1
doPush=0
while [[ $# -gt 0 ]]; do
key="$1"
case $key in
-p|--push)
doPush=1
shift # past argument
;;
*) # unknown option
echo "ERROR: ${Usage}"; exit 1
;;
esac
done
# Env and settings
IMAGE_TAG=galoisinc/hardens:latest
# clone cryptol-verilog and update its submodules prior to building the docker image
if [ -d "cryptol-verilog" ];
then echo "cryptol-verilog directory exists!"
else
git clone git@gitlab-ext.galois.com:cryptol/cryptol-verilog.git
# Make sure the right version checked out
cd cryptol-verilog
# Default Cryptol_verilog revision (signed-compare branch)
CRYPTOL_VERILOG_REV=592cc436feedf9f4325154986938872e0049215e
echo "Current Cryptol_verilog revision is ${CRYPTOL_VERILOG_REV}!"
git checkout ${CRYPTOL_VERILOG_REV}
git submodule update --init
cd -
fi
# clone crymp and update submodules prior to building the docker image
if [ -d "cryptol-codegen" ];
then echo "cryptol-codegen directory exists!"
else
git clone git@gitlab-ext.galois.com:cryptol/cryptol-codegen.git
# Make sure the right version checked out
cd cryptol-codegen
# Default Cryptol_verilog revision (hardens-tweaks branch)
CRYPTOL_CODEGEN_REV=df5540b8269d3b984d52019179120dd24aa961bf
echo "Current Cryptol_codegen revision is ${CRYPTOL_CODEGEN_REV}!"
git checkout ${CRYPTOL_CODEGEN_REV}
git submodule update --init
cd -
fi
# Build the container
echo "INFO: Building the container..."
DOCKER_BUILDKIT=1 sudo docker build \
--progress=plain \
--tag ${IMAGE_TAG} \
.
if [ $doPush -eq 1 ]; then
echo "Logging in to the docker repository"
docker login
echo "INFO: Pushing the image..."
docker push IMAGE_TAG
fi