IXWebSocket/Dockerfile

40 lines
907 B
Docker
Raw Normal View History

FROM alpine:3.11 as build
2019-10-26 20:47:08 +02:00
RUN apk add --no-cache gcc g++ musl-dev linux-headers cmake openssl-dev
RUN apk add --no-cache make
RUN apk add --no-cache zlib-dev
RUN addgroup -S app && adduser -S -G app app
RUN chown -R app:app /opt
RUN chown -R app:app /usr/local
# There is a bug in CMake where we cannot build from the root top folder
# So we build from /opt
COPY --chown=app:app . /opt
WORKDIR /opt
USER app
RUN [ "make", "ws_install" ]
RUN [ "rm", "-rf", "build" ]
2019-10-26 20:47:08 +02:00
FROM alpine:3.11 as runtime
2019-10-26 20:47:08 +02:00
RUN apk add --no-cache libstdc++
RUN apk add --no-cache strace
2019-10-26 20:47:08 +02:00
RUN addgroup -S app && adduser -S -G app app
COPY --chown=app:app --from=build /usr/local/bin/ws /usr/local/bin/ws
RUN chmod +x /usr/local/bin/ws
RUN ldd /usr/local/bin/ws
# Copy source code for gcc
COPY --chown=app:app --from=build /opt /opt
2019-10-26 20:47:08 +02:00
# Now run in usermode
USER app
WORKDIR /home/app
ENTRYPOINT ["ws"]
EXPOSE 8008
CMD ["--help"]