Files
firezone/rust/Dockerfile.dev
Gabi 8967b53170 Feat/connlib full flow (#1722)
With this PR the full control-plane message flow is working.

Meaning that if you do:

```
docker compose up -d
docker compose exec -it client "ping 172.20.0.2" # will fix this IP later
```

Messages start flowing to gateway. The gateway still not correctly
forwards the messages to the resource since masquerading is still not
working, although I suspect there might be an additional problem. Will
fix this in my next PR along with a README on how to test this whole
flow.

This PR also fixes how we sent the stamp secret to the gateway from the
relay, but I still see some warnings in the webrtc that I'm sure that
are due to a mismatch between how webrtc-rs and the relay handle
messages (The most important being `bind() failed: unexpected response
type`), I will take a look at that and a way to test that the flow works
when:
1. hole-punching is available
2. through relay when it's not
Since the flow right now works without hole-punching or relay since the
gateway is in the same network in the docker compose.
2023-07-03 19:25:37 +00:00

34 lines
1.2 KiB
Docker

FROM rust:1.70-slim as BUILDER
ARG PACKAGE
WORKDIR /build/
COPY . ./
RUN --mount=type=cache,target=./target \
--mount=type=cache,target=/usr/local/cargo/registry,sharing=locked \
--mount=type=cache,target=/usr/local/rustup,sharing=locked \
cargo build -p $PACKAGE --release
RUN --mount=type=cache,target=./target \
mv ./target/release/$PACKAGE /usr/local/bin/$PACKAGE
FROM debian:11.7-slim
ARG PACKAGE
WORKDIR /app/
COPY --from=BUILDER /usr/local/bin/$PACKAGE .
ENV RUST_BACKTRACE=1
ENV PATH "/app:$PATH"
ENV PACKAGE_NAME ${PACKAGE}
RUN apt-get update -y \
&& apt-get install -y iputils-ping \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Some black magics here:
# we need to use `/bin/sh -c` so that the env variable is correctly replaced
# but then everything in `CMD` is placed after the executed string, so we need
# to move it inside, these are passed as the variables `$0`, `$1`, `$2`, etc...
# this means that this will ignore after the first arguments
# if we ever combine this with `CMD` in exec form so always use shell form
# (Note we could use shell-form here, but this is the same made explicit)
ENTRYPOINT ["/bin/sh", "-c", "$PACKAGE_NAME $0"]
# *sigh* if we don't add this $0 becomes /bin/sh in the command above
CMD [""]