Skip to content

Commit

Permalink
build: add Dockerfile for controller, build with bottlerocket-sdk
Browse files Browse the repository at this point in the history
Build the binaries with the bottlerocket-sdk.
  • Loading branch information
etungsten committed Aug 19, 2021
1 parent 0d62444 commit 088a053
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 6 deletions.
16 changes: 14 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
.PHONY: example-test-agent-container
.PHONY: example-test-agent-container controller-container controller

# Build a container image for daemon and tools.
ARCH=$(shell uname -m)

containers: controller-container

# Build the container image for the example test-agent program
example-test-agent-container:
docker build \
--network=host \
--build-arg ARCH="$(ARCH)" \
--tag 'example_test_agent' \
-f test-agent/examples/example_test_agent/Dockerfile .

controller-container:
docker build \
--network=host \
--build-arg ARCH="$(ARCH)" \
--tag 'test-sys-controller' \
-f controller/Dockerfile .
13 changes: 13 additions & 0 deletions controller/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
ARG ARCH
FROM public.ecr.aws/bottlerocket/bottlerocket-sdk-${ARCH}:v0.22.0 as build
ARG ARCH
USER root
WORKDIR /src
ADD ./ /src/
WORKDIR /src/controller
RUN cargo install --locked --verbose --target ${ARCH}-bottlerocket-linux-musl --path . --root ./

FROM scratch
COPY --from=build /src/controller/bin/controller ./

ENTRYPOINT ["./controller"]
14 changes: 10 additions & 4 deletions test-agent/examples/example_test_agent/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
# TODO Use Bottlerocket SDK
FROM rust:1.53.0
ARG ARCH
FROM public.ecr.aws/bottlerocket/bottlerocket-sdk-${ARCH}:v0.22.0 as build
ARG ARCH
USER root
WORKDIR /src
ADD ./ /src/
WORKDIR /src/test-agent
RUN cargo install --path . --example example_test_agent --root ./
ENTRYPOINT ["/src/test-agent/bin/example_test_agent"]
RUN cargo install --locked --verbose --target ${ARCH}-bottlerocket-linux-musl --path . --example example_test_agent --root ./

FROM scratch
COPY --from=build /src/test-agent/bin/example_test_agent ./

ENTRYPOINT ["./example_test_agent"]

0 comments on commit 088a053

Please sign in to comment.