diff --git a/Dockerfile b/Dockerfile index de2e683..e4673ad 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,9 @@ -FROM ubuntu:20.04 AS builder +FROM golang:1.19 +ENV WD=/usr/src/app ENV SRT_VERSION="v1.5.3" ENV SRT_FOLDER="/opt/srt_lib" +WORKDIR ${WD} RUN apt-get clean && apt-get update && \ DEBIAN_FRONTEND=noninteractive apt-get install -y \ @@ -12,27 +14,20 @@ RUN \ mkdir -p "${SRT_FOLDER}" && \ git clone --depth 1 --branch "${SRT_VERSION}" https://github.com/Haivision/srt && \ cd srt && \ - ./configure --prefix=. $(configure) && \ + ./configure --prefix=${SRT_FOLDER} $(configure) && \ make && \ make install -FROM golang:1.19 -ENV WD=/usr/src/app -WORKDIR ${WD} - -RUN mkdir srt-lib -COPY --from=builder /srt /opt/srt - # To find where the srt.h and libsrt.so were you can # find / -name srt.h # find / -name libsrt.so # inside the container docker run -it --rm -t bash ENV GOPROXY=direct -ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/opt/srt/lib/" -ENV CGO_CFLAGS="-I/opt/srt/include/" -ENV CGO_LDFLAGS="-L/opt/srt/lib/" +ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${SRT_FOLDER}/lib/" +ENV CGO_CFLAGS="-I${SRT_FOLDER}/include/" +ENV CGO_LDFLAGS="-L${SRT_FOLDER}/lib/" COPY . ./donut WORKDIR ${WD}/donut RUN go build . -CMD ["/usr/src/app/donut/donut", "--enable-ice-mux=true"] +CMD ["/usr/src/app/donut/donut", "--enable-ice-mux=true"] \ No newline at end of file diff --git a/Dockerfile-srt-live b/Dockerfile-srt-live index 0682e06..476e5e2 100644 --- a/Dockerfile-srt-live +++ b/Dockerfile-srt-live @@ -1,7 +1,9 @@ -FROM ubuntu:20.04 AS builder +FROM golang:1.19 +ENV WD=/usr/src/app ENV SRT_VERSION="v1.5.3" -ENV SRC_FOLDER="/opt/srt_lib" +ENV SRT_FOLDER="/opt/srt_lib" +WORKDIR ${WD} RUN apt-get clean && apt-get update && \ DEBIAN_FRONTEND=noninteractive apt-get install -y \ @@ -9,11 +11,12 @@ RUN apt-get clean && apt-get update && \ && apt-get clean RUN \ - mkdir -p "${SRC_FOLDER}" && \ + mkdir -p "${SRT_FOLDER}" && \ git clone --depth 1 --branch "${SRT_VERSION}" https://github.com/Haivision/srt && \ cd srt && \ - ./configure --prefix=. $(configure) && \ + ./configure --prefix=${SRT_FOLDER} $(configure) && \ make && \ make install -ENV PATH="${PATH}:/srt" -WORKDIR ${WD} \ No newline at end of file + +ENV PATH="${PATH}:/usr/src/app/srt" +WORKDIR ${WD} diff --git a/docker-compose.yaml b/docker-compose.yaml index cd19edd..66c6671 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -17,7 +17,8 @@ services: context: . dockerfile: Dockerfile-srt-live entrypoint: sh - command: "./scripts/srt.sh" + command: "./srt.sh" + working_dir: "/scripts" volumes: - "./scripts:/scripts" environment: