Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions dist/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
FROM centos:7

RUN yum -y groupinstall 'Development Tools'
RUN yum -y install openssl-devel
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have you tested resulting image with this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested the steps from the docker-based stack outlined in #20 and it works as expected

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally our CI would test that ;-)


ENV RUST_LOG=actix_web=error,dkregistry=error

COPY target/x86_64-unknown-linux-musl/release/graph-builder target/x86_64-unknown-linux-musl/release/policy-engine /usr/bin/
COPY graph-builder policy-engine /usr/bin/

ENTRYPOINT ["/usr/bin/graph-builder"]
22 changes: 18 additions & 4 deletions dist/build_deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,29 @@
set -e

ABSOLUTE_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
IMAGE_BUILD="${IMAGE_BUILD:-clux/muslrust:1.30.0-stable}"
source "${ABSOLUTE_PATH}/commons.sh"

IMAGE="quay.io/app-sre/cincinnati"
IMAGE_TAG=$(git rev-parse --short=7 HEAD)
PROJECT_PARENT_DIR=$ABSOLUTE_PATH/../
DOCKERFILE_DEPLOY="$ABSOLUTE_PATH/Dockerfile"
RELEASE_DIR="${PROJECT_PARENT_DIR}/target/x86_64-unknown-linux-musl/release"
RELEASE_OUTPUT_DIR="${PROJECT_PARENT_DIR}/release-$(date +'%Y%m%d.%H%M%S')"

function cleanup() {
set +e
if [[ ! -n "$KEEP_RELEASE_OUTPUT" ]]; then
rm -f ${RELEASE_OUTPUT_DIR}/{graph-builder,policy-engine}
rmdir ${RELEASE_OUTPUT_DIR}
fi
docker_cargo clean
}
trap cleanup EXIT

docker run -t --rm -v $PROJECT_PARENT_DIR:/volume:Z $IMAGE_BUILD cargo build --release
docker_cargo build --release
mkdir $RELEASE_OUTPUT_DIR
cp ${RELEASE_DIR}/{graph-builder,policy-engine} $RELEASE_OUTPUT_DIR/

docker build -f $DOCKERFILE_DEPLOY -t "${IMAGE}:${IMAGE_TAG}" $PROJECT_PARENT_DIR
docker build -f $DOCKERFILE_DEPLOY -t "${IMAGE}:${IMAGE_TAG}" $RELEASE_OUTPUT_DIR

if [[ -n "$QUAY_USER" && -n "$QUAY_TOKEN" ]]; then
DOCKER_CONF="$PWD/.docker"
Expand Down
13 changes: 13 additions & 0 deletions dist/commons.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash

IMAGE_BUILD="${IMAGE_BUILD:-clux/muslrust:1.30.0-stable}"
PROJECT_PARENT_DIR="${ABSOLUTE_PATH:?need ABSOLUTE_PATH set}/../"

function docker_cargo () {
docker run -t --rm \
--user "$UID:$GID" \
--tmpfs "/tmp/cargo:rw" \
--env "CARGO_HOME=/tmp/cargo" \
-v $PROJECT_PARENT_DIR:/volume:Z \
$IMAGE_BUILD cargo ${@}
}
11 changes: 8 additions & 3 deletions dist/pr_check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
set -e

ABSOLUTE_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
IMAGE_BUILD="${IMAGE_BUILD:-clux/muslrust:1.30.0-stable}"
PROJECT_PARENT_DIR=$ABSOLUTE_PATH/../
source "${ABSOLUTE_PATH}/commons.sh"

docker run -t --rm -v $PROJECT_PARENT_DIR:/volume:Z $IMAGE_BUILD cargo test
function cleanup() {
set +e
docker_cargo clean
}
trap cleanup EXIT

docker_cargo test