diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..7bac8aa --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +target +docs diff --git a/Dockerfile b/Dockerfile index 5f262d0..dfca3f9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,13 @@ FROM rust:1.50 as builder -RUN cargo install --git https://github.com/roapi/roapi --branch main --bin roapi-http +ARG RELEASE=main +RUN cargo install --git https://github.com/roapi/roapi --branch $RELEASE --bin roapi-http FROM debian:buster-slim +LABEL org.opencontainers.image.source https://github.com/roapi/roapi + RUN apt-get update && apt-get install -y libssl-dev && rm -rf /var/lib/apt/lists/* COPY test_data /test_data COPY --from=builder /usr/local/cargo/bin/roapi-http /usr/local/bin/roapi-http -CMD ["roapi-http"] \ No newline at end of file +EXPOSE 8080 +ENTRYPOINT ["roapi-http"] diff --git a/README.md b/README.md index 9dd88eb..86c5e8b 100644 --- a/README.md +++ b/README.md @@ -31,10 +31,7 @@ See below for a high level diagram: cargo install --git https://github.com/roapi/roapi --branch main --bin roapi-http ``` -```bash -# docker build -docker build . -t roapi-http -``` +A prebuilt docker image is also available at [ghcr.io/roapi/roapi-http](https://github.com/orgs/roapi/packages/container/package/roapi-http). ## Usage @@ -50,9 +47,10 @@ roapi-http \ --table 'spacex_launches:test_data/spacex-launches.json' ``` +Or using docker: + ```bash -# docker run -docker run --rm -t -p 8080:8080 roapi-http roapi-http --addr 0.0.0.0:8080 \ +docker run -t --rm -p 8080:8080 ghcr.io/roapi/roapi-http:latest --addr 0.0.0.0:8080 \ --table 'uk_cities:test_data/uk_cities_with_headers.csv' \ --table 'spacex_launches:test_data/spacex-launches.json' ``` @@ -282,3 +280,12 @@ wraps `columnq` with a HTTP based API layer. It serializes Arrow record batches produced by `columnq` into different formats based on client request. Building ROAPI with `simd` optimization requires nightly rust toolchain. + + +### Build Docker image + +```bash +docker build --build-arg RELEASE=main --rm -t ghcr.io/roapi/roapi-http:latest . +``` + +You can set `RELEASE` variable to any git reference to build for a specific version.