Skip to content

Commit 22f05e8

Browse files
committed
adds Dockerfile
1 parent bdf67cf commit 22f05e8

File tree

6 files changed

+52
-6
lines changed

6 files changed

+52
-6
lines changed

Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Dockerfile

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
####################################################################################################
2+
## Builder
3+
####################################################################################################
4+
FROM rust:1.70 AS builder
5+
6+
RUN rustup target add x86_64-unknown-linux-musl
7+
RUN apt update && apt install -y musl-tools musl-dev
8+
9+
RUN addgroup --gid 10001 --system nonroot \
10+
&& adduser --uid 10000 --system --ingroup nonroot --home /home/nonroot nonroot
11+
12+
WORKDIR /regan
13+
14+
COPY ./ .
15+
RUN cargo build --target x86_64-unknown-linux-musl --release
16+
17+
####################################################################################################
18+
## Final image
19+
####################################################################################################
20+
FROM scratch
21+
22+
COPY --from=builder /etc/passwd /etc/passwd
23+
COPY --from=builder /etc/group /etc/group
24+
25+
WORKDIR /regan
26+
27+
COPY --from=builder /regan/target/x86_64-unknown-linux-musl/release/server ./
28+
COPY --from=builder /regan/static/ ./static/
29+
30+
USER nonroot:nonroot
31+
32+
ENTRYPOINT ["/regan/server"]
33+
34+
CMD ["--image-dir", "/var/regan/images/",\
35+
"--port" , "80", \
36+
"--output", "/var/regan/results.db"]

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@ The server provides a platform for comparing images. It will select images from
2424

2525
The matchmaking strategy of the server tries to select those images with the highest uncertainty about their rank.
2626

27+
#### Server with Docker
28+
A Dockerfile is provided for people who want to use docker for hosting the server.
29+
You have to define volumes for the input images (at least read access) and a directoy, where the sqlite database is written.
30+
Also, port publish is also needed.
31+
An example on how to run it with docker where `YOUR_DIRECTOY/images` contains images
32+
```
33+
docker build -t regan .
34+
docker run -v <YOUR_DIRECTORY>:/var/regan/ -p <HOST_PORT>:80/tcp regan
35+
```
36+
2737
#### Parameters
2838
Use `--help` to see the parameter documentation
2939

image_collection/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "image_collection"
3-
version = "0.2.0"
3+
version = "0.2.1"
44
edition = "2021"
55

66
[lib]

server/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "server"
3-
version = "0.2.0"
3+
version = "0.2.1"
44
edition = "2021"
55

66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

simulation/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "simulation"
3-
version = "0.2.0"
3+
version = "0.2.1"
44
edition = "2021"
55

66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

0 commit comments

Comments
 (0)