-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
39 lines (20 loc) · 903 Bytes
/
Dockerfile
File metadata and controls
39 lines (20 loc) · 903 Bytes
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
FROM rust:latest as cargo-build
RUN apt-get update
RUN apt-get install musl-tools -y
RUN rustup target add x86_64-unknown-linux-musl
WORKDIR /usr/src/tvheadproxy
COPY Cargo.toml Cargo.toml
RUN mkdir src/
RUN echo "fn main() {println!(\"if you see this, the build broke\")}" > src/main.rs
RUN RUSTFLAGS=-Clinker=musl-gcc cargo build --release --target=x86_64-unknown-linux-musl
RUN rm -f target/x86_64-unknown-linux-musl/release/deps/tvheadproxy*
COPY src src
RUN RUSTFLAGS=-Clinker=musl-gcc cargo build --release --target=x86_64-unknown-linux-musl
FROM alpine:latest
RUN addgroup -g 1000 tvheadproxy
RUN adduser -D -s /bin/sh -u 1000 -G tvheadproxy tvheadproxy
WORKDIR /home/tvheadproxy/bin/
COPY --from=cargo-build /usr/src/tvheadproxy/target/x86_64-unknown-linux-musl/release/tvheadproxy .
RUN chown tvheadproxy:tvheadproxy tvheadproxy
USER tvheadproxy
ENTRYPOINT ["./tvheadproxy"]