robocar-camera/Dockerfile

36 lines
987 B
Docker
Raw Permalink Normal View History

2021-10-12 16:28:11 +00:00
ARG OPENCV_VERSION=v4.5.3
2020-09-06 12:53:53 +00:00
FROM docker.io/golang:1.18-alpine as gobuilder
2019-12-18 23:08:07 +00:00
2021-10-12 16:28:11 +00:00
FROM docker.io/cyrilix/opencv-buildstage:${OPENCV_VERSION} as builder
2019-12-18 23:08:07 +00:00
LABEL maintainer="Cyrille Nofficial"
COPY --from=gobuilder /usr/local/go /usr/local/go
ENV GOPATH /go
ENV PATH /usr/local/go/bin:$GOPATH/bin:/usr/local/go/bin:$PATH
RUN mkdir -p "/src $GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"
ENV PKG_CONFIG_PATH /usr/local/lib/pkgconfig:/usr/local/lib64/pkgconfig
ENV CGO_CPPFLAGS -I/usr/local/include
ENV CGO_CXXFLAGS "--std=c++1z"
WORKDIR /src
ADD . .
RUN CGO_LDFLAGS="$(pkg-config --libs opencv4)" \
2020-04-04 10:32:27 +00:00
CGO_ENABLED=1 CGO_CPPFLAGS=${CGO_CPPFLAGS} CGO_CXXFLAGS=${CGO_CXXFLAGS} CGO_LDFLAGS=${CGO_LDFLAGS} GOOS=${GOOS} GOARCH=${GOARCH} GOARM=${GOARM} go build -a ./cmd/rc-camera/
2019-12-18 23:08:07 +00:00
2021-10-12 16:28:11 +00:00
FROM docker.io/cyrilix/opencv-runtime:${OPENCV_VERSION}
2019-12-18 23:08:07 +00:00
ENV LD_LIBRARY_PATH /usr/local/lib:/usr/local/lib64
USER 1234
COPY --from=builder /src/rc-camera /go/bin/rc-camera
ENTRYPOINT ["/go/bin/rc-camera"]