FROM golang:bullseye AS builder
RUN apt update && apt install -y build-essential libavcodec-dev libavutil-dev libswscale-dev
RUN mkdir /tmp/srd && go env -w GOPROXY="https://goproxy.io,direct"
ADD ./ /tmp/srd/
RUN cd /tmp/srd && make all

FROM debian:bullseye
MAINTAINER "Mingcai SHEN <archsh@gmail.com>"
RUN apt update && apt install -y libavcodec58 libavutil56 libswscale5
COPY --from=builder /tmp/srd/sport_rec_demo /usr/local/bin
EXPOSE 3000
CMD ["/usr/local/bin/sport_rec_demo", "serve", "-L", ":3000"]
