Skip to content

Commit

Permalink
initial project setup
Browse files Browse the repository at this point in the history
In this commit we set up the basic project structure.
- An integ crate that will serve as our driver for integration testing.
  Eventually this will be used to set up and run Bottlerocket instances
  that the updater can be tested against.
- The updater crate. This will become the binary that checks and updates
  Bottlerocket instances.
- A simple Dockerfile and Makefile, since we will be deploying the
  updater to Fargate.

updater has a lib.rs file so that we can re-use some code from updater
in integ, and so that updater can have a useful tests directory.
  • Loading branch information
webern committed Jan 21, 2021
1 parent 5fcf3aa commit 51fca71
Show file tree
Hide file tree
Showing 11 changed files with 3,342 additions and 0 deletions.
32 changes: 32 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
BOTTLEROCKET_SDK_VERSION ?= 0.15.0
BOTTLEROCKET_SDK_SITE ?= cache.bottlerocket.aws
LOCAL_ARCH ?= $(shell uname -m)
TARGET_ARCH ?= x86_64

# the docker image that will be used to compile rust code
BUILDER_IMAGE ?= bottlerocket/sdk-$(TARGET_ARCH):v$(BOTTLEROCKET_SDK_VERSION)-$(LOCAL_ARCH)

# the target triple that will be passed to the cargo build command with as --target
RUST_TARGET ?= $(TARGET_ARCH)-bottlerocket-linux-musl

.PHONY: image # creates a docker image with the updater binary
image: fetch-sdk
DOCKER_BUILDKIT=1 \
docker build \
-t bottlerocket-ecs-updater:latest \
--build-arg BUILDER_IMAGE=${BUILDER_IMAGE} \
--build-arg RUST_TARGET=${RUST_TARGET} \
"${PWD}/updater"

.PHONY: fetch-sdk
fetch-sdk: # fetches and loads the image we use to build the updater docker image
set -eou pipefail; \
if ! docker image inspect ${BUILDER_IMAGE} >/dev/null 2>&1; then \
if ! curl --fail --show-error https://${BOTTLEROCKET_SDK_SITE}/${BUILDER_IMAGE}.tar.gz \
| gunzip | docker load; then \
echo "failed to load '${BUILDSYS_SDK_IMAGE}'" >&2; \
exit 1; \
fi \
else \
echo "${BUILDER_IMAGE} is already loaded"; \
fi
Loading

0 comments on commit 51fca71

Please sign in to comment.