mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 10:18:54 +00:00
This PR fixes a bunch of small things to allow a new flow to test clients pinging a resource within docker compose. Masquerade/Forwarding is enabled directly in the container for now, this might change in the future. Also added a README to be able to run this locally. --------- Signed-off-by: Gabi <gabrielalejandro7@gmail.com> Co-authored-by: Jamil <jamilbk@users.noreply.github.com>
35 lines
1.3 KiB
Docker
35 lines
1.3 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 .
|
|
COPY ./docker-init.sh .
|
|
ENV RUST_BACKTRACE=1
|
|
ENV PATH "/app:$PATH"
|
|
ENV PACKAGE_NAME ${PACKAGE}
|
|
RUN apt-get update -y \
|
|
&& apt-get install -y iputils-ping iptables lsof \
|
|
&& 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", "./docker-init.sh && $PACKAGE_NAME $0"]
|
|
# *sigh* if we don't add this $0 becomes /bin/sh in the command above
|
|
CMD [""]
|