-
Notifications
You must be signed in to change notification settings - Fork 63
/
Copy pathDockerfile
60 lines (47 loc) · 1.76 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
FROM rust:slim-bookworm AS build
# Create a build directory and copy over all of the files
WORKDIR /build
COPY . ./
# 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
# 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
## build-wasm
FROM rust:slim AS build-wasm
WORKDIR /build
RUN apt-get update && apt-get install -y ca-certificates curl build-essential nodejs npm
# Install Rustup
RUN rustup target add wasm32-unknown-unknown
RUN cargo install -f wasm-bindgen-cli
# Install node dependencies
COPY package.json package-lock.json ./
RUN npm ci
# Copy the rest
COPY . ./
# Build it
RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/build/target \
npm run build
# moq-clock
FROM debian:bookworm-slim AS moq-clock
COPY --from=build /usr/local/cargo/bin/moq-clock /usr/local/bin
ENTRYPOINT ["moq-clock"]
## moq-karp (and moq-bbb)
FROM debian:bookworm-slim AS moq-karp
RUN apt-get update && apt-get install -y ffmpeg wget
COPY ./deploy/moq-bbb /usr/local/bin/moq-bbb
COPY --from=build /usr/local/cargo/bin/moq-karp /usr/local/bin
ENTRYPOINT ["moq-karp"]
## moq-web
FROM caddy:alpine AS moq-web
EXPOSE 443
COPY --from=build-wasm /build/dist /srv
ENTRYPOINT ["caddy", "file-server", "--root", "/srv", "--listen", ":443"]
## moq-relay
FROM debian:bookworm-slim AS moq-relay
COPY --from=build /usr/local/cargo/bin/moq-relay /usr/local/bin
ENTRYPOINT ["moq-relay"]