2023-09-07 20:02:07 +00:00
|
|
|
FROM rust:latest as builder
|
|
|
|
|
2023-09-15 19:06:28 +00:00
|
|
|
# Create a build directory and copy over all of the files
|
|
|
|
WORKDIR /build
|
2023-09-07 20:02:07 +00:00
|
|
|
COPY . .
|
|
|
|
|
2023-09-15 19:06:28 +00:00
|
|
|
# Reuse a cache between builds.
|
|
|
|
# I tried to `cargo install`, but it doesn't seem to work with workspaces.
|
|
|
|
# There's also issues with the cache mount since it builds into /usr/local/cargo/bin, and we can't mount that without clobbering cargo itself.
|
|
|
|
# We instead we build the binaries and copy them to the cargo bin directory.
|
|
|
|
RUN --mount=type=cache,target=/usr/local/cargo/registry \
|
|
|
|
--mount=type=cache,target=/build/target \
|
|
|
|
cargo build --release && cp /build/target/release/moq-* /usr/local/cargo/bin
|
2023-09-07 20:02:07 +00:00
|
|
|
|
2023-11-03 04:56:45 +00:00
|
|
|
# Special image for moq-pub with ffmpeg and a publish script included.
|
|
|
|
FROM rust:latest as moq-pub
|
|
|
|
|
|
|
|
# Install required utilities and ffmpeg
|
|
|
|
RUN apt-get update && \
|
|
|
|
apt-get install -y ffmpeg wget
|
|
|
|
|
|
|
|
# Copy the publish script into the image
|
|
|
|
COPY deploy/publish.sh /usr/local/bin/publish
|
|
|
|
|
|
|
|
# Copy the compiled binary
|
|
|
|
COPY --from=builder /usr/local/cargo/bin/moq-pub /usr/local/cargo/bin/moq-pub
|
|
|
|
CMD [ "publish" ]
|
|
|
|
|
|
|
|
# moq-rs image with just the binaries
|
|
|
|
FROM rust:latest as moq-rs
|
2023-09-07 20:02:07 +00:00
|
|
|
|
2023-09-17 07:20:57 +00:00
|
|
|
LABEL org.opencontainers.image.source=https://github.com/kixelated/moq-rs
|
2023-09-17 07:22:57 +00:00
|
|
|
LABEL org.opencontainers.image.licenses="MIT OR Apache-2.0"
|
2023-09-17 07:20:57 +00:00
|
|
|
|
2023-09-15 20:10:13 +00:00
|
|
|
# Fly.io entrypoint
|
2023-11-03 04:56:45 +00:00
|
|
|
ADD deploy/fly-relay.sh .
|
2023-09-15 20:10:13 +00:00
|
|
|
|
2023-09-15 19:06:28 +00:00
|
|
|
# Copy the compiled binaries
|
|
|
|
COPY --from=builder /usr/local/cargo/bin /usr/local/cargo/bin
|