Builds Docker images from the local copy and adds Docker instructions to the main README

Will allow to easily setup a GitHub actions for Docker images release
https://docs.github.com/en/actions/language-and-framework-guides/publishing-docker-images
pull/42/head
Tpt 4 years ago
parent 44c9a71820
commit cfc7b29a57
  1. 47
      README.md
  2. 65
      docker/README.md
  3. 11
      docker/publish_docker_images.sh
  4. 8
      server/Dockerfile
  5. 9
      wikibase/Dockerfile

@ -33,8 +33,6 @@ You need to have [a recent stable version of Rust and Cargo installed](https://w
If it's done, executing `cargo build --release` in the root directory of this repository should compile the full server after having downloaded its dependencies. If it's done, executing `cargo build --release` in the root directory of this repository should compile the full server after having downloaded its dependencies.
It will create a fat binary in `target/release/oxigraph_server`. It will create a fat binary in `target/release/oxigraph_server`.
Alternatively, you can use the [Docker image](./docker#readme).
### Usage ### Usage
Run `./oxigraph_server` to start the server. It listen by default on `localhost:7878`. Run `./oxigraph_server` to start the server. It listen by default on `localhost:7878`.
@ -52,8 +50,32 @@ It provides the following REST actions:
Use `oxigraph_server --help` to see the possible options when starting the server. Use `oxigraph_server --help` to see the possible options when starting the server.
### Using a Docker image
#### Display the help menu
```sh
docker run --rm oxigraph/oxigraph --help
```
#### Run the web server
Expose the server on port `7878` of the host machine, and save data on the local `./data` folder
```sh
docker run --init --rm -v $PWD/data:/data -p 7878:7878 oxigraph/oxigraph -b 0.0.0.0:7878 -f /data
```
You can then access it from your machine on port `7878`:
```sh
# Open the GUI in a browser
firefox http://localhost:7878
# Post some data
curl http://localhost:7878 -H 'Content-Type: application/x-turtle' -d@./data.ttl
# Make a query
curl -H 'Accept: application/sparql-results+json' 'http://localhost:7878/query?query=SELECT%20*%20%7B%20%3Fs%20%3Fp%20%3Fo%20%7D%20LIMIT%2010'
```
## Run the web server for Wikibase You could easily build your own Docker image by running `docker build -t oxigraph server -f server/Dockerfile .` from the root directory.
### Build ### Build
@ -62,8 +84,6 @@ You need to have [a recent stable version of Rust and Cargo installed](https://w
If it's done, executing `cargo build --release` in the root directory of this repository should compile the full server after having downloaded its dependencies. If it's done, executing `cargo build --release` in the root directory of this repository should compile the full server after having downloaded its dependencies.
It will create a fat binary in `target/release/oxigraph_wikibase`. It will create a fat binary in `target/release/oxigraph_wikibase`.
Alternatively, you can use the [Docker image](./docker#readme).
### Usage ### Usage
To start a server that is synchronized with [test.wikidata.org](https://test.wikidata.org) you should run: To start a server that is synchronized with [test.wikidata.org](https://test.wikidata.org) you should run:
@ -79,6 +99,23 @@ The configuration parameters are:
* `namespaces` The ids of the Wikibase namespaces to synchronize with, separated by `,`. * `namespaces` The ids of the Wikibase namespaces to synchronize with, separated by `,`.
* `file` Path of where Oxigraph should store its data. * `file` Path of where Oxigraph should store its data.
### Using a Docker image
#### Display the help menu
```sh
docker run --rm oxigraph/oxigraph-wikibase --help
```
#### Run the web server
Expose the server on port `7878` of the host machine, and save data on the local `./data` folder
```sh
docker run --init --rm -v $PWD/wikibase_data:/wikibase_data -p 7878:7878 oxigraph/oxigraph-wikibase -b 0.0.0.0:7878 -f /wikibase_data --mediawiki-api http://some.wikibase.instance/w/api.php --mediawiki-base-url http://some.wikibase.instance/wiki/
```
Warning: the Wikibase instance needs to be accessible from within the container.
The clean way to do that could be to have both your wikibase and oxigraph_wikibase in the same [`docker-compose.yml`](https://docs.docker.com/compose/).
You could easily build your own Docker image by running `docker build -t oxigraph-wikibase -f wikibase/Dockerfile .` from the root directory.
## License ## License

@ -1,65 +0,0 @@
# docker-oxigraph
[Oxigraph](https://github.com/oxigraph/oxigraph) in a [Docker container](https://www.docker.com/resources/what-container).
[![DockerHub Badge Oxigraph](https://dockeri.co/image/oxigraph/oxigraph)](https://hub.docker.com/r/oxigraph/oxigraph/)
[![DockerHub Badge Oxigraph-Wikibase](https://dockeri.co/image/oxigraph/oxigraph-wikibase)](https://hub.docker.com/r/oxigraph/oxigraph-wikibase/)
## Summary
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
- [Display help menu](#display-help-menu)
- [Run the web server](#run-the-web-server)
- [Run the web server for Wikibase](#run-the-web-server-for-wikibase)
- [Build local image](#build-local-image)
- [server image](#server-image)
- [Wikibase server image](#wikibase-server-image)
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
## Display the help menu
```sh
docker run --rm oxigraph/oxigraph --help
```
## Run the web server
Expose the server on port `7878` of the host machine, and save data on the local `./data` folder
```sh
docker run --init --rm -v $PWD/data:/data -p 7878:7878 oxigraph/oxigraph -b 0.0.0.0:7878 -f /data
```
You can then access it from your machine on port `7878`:
```sh
# Open the GUI in a browser
firefox http://localhost:7878
# Post some data
curl http://localhost:7878 -H 'Content-Type: application/x-turtle' -d@./data.ttl
# Make a query
curl -H 'Accept: application/sparql-results+json' 'http://localhost:7878/query?query=SELECT%20*%20%7B%20%3Fs%20%3Fp%20%3Fo%20%7D%20LIMIT%2010'
```
## Run the web server for Wikibase
```sh
docker run --init --rm -v $PWD/wikibase_data:/wikibase_data -p 7878:7878 oxigraph/oxigraph-wikibase -b 0.0.0.0:7878 -f /wikibase_data --mediawiki-api http://some.wikibase.instance/w/api.php --mediawiki-base-url http://some.wikibase.instance/wiki/
```
:warning: the Wikibase instance needs to be accessible from within the container. The clean way to do that could be to have both your wikibase and oxigraph in the same [`docker-compose.yml`](https://docs.docker.com/compose/).
## Build local image
### server image
```sh
# Build with no build context, just the Dockerfile
cat Dockerfile | docker build -t oxigraph -
```
### Wikibase server image
```sh
# Same, simply replacing the entrypoint
cat Dockerfile | sed s/oxigraph_server/oxigraph_wikibase/ | docker build -t oxigraph-wikibase -
```

@ -1,11 +0,0 @@
#!/usr/bin/env bash
if [[ -z ./Dockerfile ]] ; then
echo 'this script should be run the docker directory'
exit 1
fi
cat server/Dockerfile | docker build -t oxigraph/oxigraph -
cat wikibase/Dockerfile | docker build -t oxigraph/oxigraph-wikibase -
docker push oxigraph/oxigraph:latest
docker push oxigraph/oxigraph-wikibase:latest

@ -1,10 +1,8 @@
FROM rust:1-buster as builder FROM rust:1-buster as builder
RUN apt-get update && \ RUN apt-get update && apt-get install clang -y
apt-get install clang -y && \ COPY . /oxigraph
git clone https://github.com/oxigraph/oxigraph --depth 1 && \ RUN cd /oxigraph/server && cargo build --release
cd oxigraph && \
cargo build --release
FROM debian:buster-slim FROM debian:buster-slim

@ -1,13 +1,12 @@
FROM rust:1-buster as builder FROM rust:1-buster as builder
RUN apt-get update && \ RUN apt-get update && apt-get install clang -y
apt-get install clang -y && \ COPY . /oxigraph
git clone https://github.com/oxigraph/oxigraph --depth 1 && \ RUN cd /oxigraph/wikibase && cargo build --release
cd oxigraph && \
cargo build --release
FROM debian:buster-slim FROM debian:buster-slim
RUN apt-get update && apt-get install ca-certificates -y && rm -rf /var/lib/apt/lists/*
COPY --from=builder /oxigraph/target/release/oxigraph_wikibase /usr/local/bin/oxigraph_wikibase COPY --from=builder /oxigraph/target/release/oxigraph_wikibase /usr/local/bin/oxigraph_wikibase
ENTRYPOINT [ "/usr/local/bin/oxigraph_wikibase" ] ENTRYPOINT [ "/usr/local/bin/oxigraph_wikibase" ]

Loading…
Cancel
Save