mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 10:18:54 +00:00
feat(relay): add Dockerfile (#1661)
This adds a basic Dockerfile for the relay so users and devs can easily start it.
This commit is contained in:
1
rust/.dockerignore
Normal file
1
rust/.dockerignore
Normal file
@@ -0,0 +1 @@
|
||||
target/
|
||||
23
rust/relay.Dockerfile
Normal file
23
rust/relay.Dockerfile
Normal file
@@ -0,0 +1,23 @@
|
||||
# syntax=docker/dockerfile:1.5-labs
|
||||
FROM rust:1.70-slim as builder
|
||||
|
||||
WORKDIR /workspace
|
||||
ADD . .
|
||||
RUN --mount=type=cache,target=./target \
|
||||
--mount=type=cache,target=/usr/local/cargo/registry \
|
||||
--mount=type=cache,target=/usr/local/rustup \
|
||||
rustup target add x86_64-unknown-linux-musl && \
|
||||
cargo build --release --bin relay --target x86_64-unknown-linux-musl
|
||||
|
||||
RUN --mount=type=cache,target=./target \
|
||||
mv ./target/x86_64-unknown-linux-musl/release/relay /usr/local/bin/relay
|
||||
|
||||
FROM scratch
|
||||
COPY --from=builder /usr/local/bin/relay /usr/local/bin/relay
|
||||
ENV RUST_BACKTRACE=1
|
||||
|
||||
EXPOSE 3478/udp
|
||||
EXPOSE 49152-65535/udp
|
||||
|
||||
# This purposely does not include an `init` process. Use `docker run --init` for proper signal handling.
|
||||
ENTRYPOINT ["relay"]
|
||||
@@ -22,6 +22,11 @@ You can build the server using: `cargo build --release --bin relay`
|
||||
|
||||
For a detailed help text and available configuration options, run `cargo run --bin relay -- --help`.
|
||||
|
||||
## Docker
|
||||
|
||||
There is a docker image one directory up from this README: [Dockerfile](../relay.Dockerfile).
|
||||
The Rust binary itself does not include any signal handling, thus you need to run the container with `--init` if you want to be able to CTRL+C the running container.
|
||||
|
||||
## Design
|
||||
|
||||
The relay is designed in a sans-IO fashion, meaning the core components do not cause side effects but operate as pure, synchronous state machines.
|
||||
|
||||
Reference in New Issue
Block a user