Skip to content
This repository has been archived by the owner on Jul 21, 2023. It is now read-only.

Commit

Permalink
facilitator Dockerfile
Browse files Browse the repository at this point in the history
Adds a Dockerfile that builds the facilitator in a minimal Alpine Linux
container, then packages the statically linked binary into another
Alpine Linux container. Also adds a `docker build` step to CI build.
  • Loading branch information
tgeoghegan committed Sep 28, 2020
1 parent 995a63c commit 0339d09
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 5 deletions.
17 changes: 13 additions & 4 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ on:
env:
CARGO_TERM_COLOR: always

defaults:
run:
working-directory: facilitator

jobs:
build-rust:
defaults:
run:
working-directory: facilitator
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -25,3 +24,13 @@ jobs:
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Docker build
uses: docker/setup-buildx-action@v1
- name: build
uses: docker/build-push-action@v2
with:
file: facilitator/Dockerfile
16 changes: 16 additions & 0 deletions facilitator/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM rust:1.46-alpine as builder

RUN apk add libc-dev && apk update

WORKDIR /usr/src/prio-server
# We enumerate these paths so that `docker build` fails in an obvious way if run
# from the wrong place.
COPY ./avro-schema ./avro-schema
COPY ./facilitator ./facilitator

RUN cargo install --path ./facilitator

FROM rust:1.46-alpine
RUN apk update
COPY --from=builder /usr/local/cargo/bin/facilitator /usr/local/bin/facilitator
ENTRYPOINT ["/usr/local/bin/facilitator"]
6 changes: 5 additions & 1 deletion facilitator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@ This is ISRG's implementation of a Prio accumulation server. It ingests a share

## Getting started

[Install a Rust toolchain](https://www.rust-lang.org/tools/install), then just `cargo build|run|test`.
[Install a Rust toolchain](https://www.rust-lang.org/tools/install), then just `cargo build|run|test`. See `cargo run -- --help` for information on the various options and subcommands.

## Generating ingestion data

To generate sample ingestion data, see the `generate-ingestion-sample` command and its usage (`cargo run -- generate-ingestion-sample --help`).

## Docker

To build a Docker image, try `docker build -t my-image-repository/facilitator:x.y.z -f facilitator/Dockerfile .` *from the root directory of `prio-server`*. This is important because building `facilitator` depends on the schema files in `avro-schema`.

## References

[Prio Data Share Batch IDL](https://docs.google.com/document/d/1L06dpE7OcC4CXho2UswrfHrnWKtbA9aSSmO_5o7Ku6I/edit#heading=h.3kq1yexquq2g)
Expand Down
File renamed without changes.

0 comments on commit 0339d09

Please sign in to comment.