2020-06-03 05:31:32 +02:00
|
|
|
FROM alpine:3.12 as build
|
2019-05-31 09:43:22 +02:00
|
|
|
|
2020-03-29 22:05:31 +02:00
|
|
|
RUN apk add --no-cache \
|
|
|
|
gcc g++ musl-dev linux-headers \
|
2020-09-28 20:56:49 +02:00
|
|
|
cmake mbedtls-dev make zlib-dev python3-dev ninja git
|
2019-05-31 09:43:22 +02:00
|
|
|
|
2020-03-29 22:05:31 +02:00
|
|
|
RUN addgroup -S app && \
|
|
|
|
adduser -S -G app app && \
|
|
|
|
chown -R app:app /opt && \
|
|
|
|
chown -R app:app /usr/local
|
2019-05-31 09:43:22 +02:00
|
|
|
|
|
|
|
# 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
|
2020-03-29 22:05:31 +02:00
|
|
|
RUN make ws_mbedtls_install && \
|
|
|
|
sh tools/trim_repo_for_docker.sh
|
2019-05-31 09:43:22 +02:00
|
|
|
|
2020-06-03 05:31:32 +02:00
|
|
|
FROM alpine:3.12 as runtime
|
2019-05-31 09:43:22 +02:00
|
|
|
|
2020-09-04 22:47:12 +02:00
|
|
|
RUN apk add --no-cache libstdc++ mbedtls ca-certificates python3 strace && \
|
2020-03-29 22:05:31 +02:00
|
|
|
addgroup -S app && \
|
|
|
|
adduser -S -G app app
|
2019-05-31 09:43:22 +02:00
|
|
|
|
|
|
|
COPY --chown=app:app --from=build /usr/local/bin/ws /usr/local/bin/ws
|
|
|
|
|
2020-03-29 22:05:31 +02:00
|
|
|
# COPY --chown=app:app --from=build /opt /opt
|
|
|
|
|
|
|
|
RUN chmod +x /usr/local/bin/ws && \
|
|
|
|
ldd /usr/local/bin/ws
|
2020-01-07 23:58:30 +01:00
|
|
|
|
2019-05-31 09:43:22 +02:00
|
|
|
# Now run in usermode
|
|
|
|
USER app
|
|
|
|
WORKDIR /home/app
|
|
|
|
|
|
|
|
ENTRYPOINT ["ws"]
|
2019-09-26 23:36:14 +02:00
|
|
|
EXPOSE 8008
|