| 1 |
FROM centos:8 as build |
| 2 |
|
| 3 |
RUN yum install -y gcc-c++ make cmake zlib-devel openssl-devel redhat-rpm-config |
| 4 |
|
| 5 |
RUN yum install -y epel-release |
| 6 |
RUN yum install -y mbedtls-devel |
| 7 |
|
| 8 |
RUN groupadd app && useradd -g app app |
| 9 |
RUN chown -R app:app /opt |
| 10 |
RUN chown -R app:app /usr/local |
| 11 |
|
| 12 |
# There is a bug in CMake where we cannot build from the root top folder |
| 13 |
# So we build from /opt |
| 14 |
COPY --chown=app:app . /opt |
| 15 |
WORKDIR /opt |
| 16 |
|
| 17 |
USER app |
| 18 |
RUN [ "make", "ws_mbedtls_install" ] |
| 19 |
RUN [ "rm", "-rf", "build" ] |
| 20 |
|
| 21 |
FROM centos:8 as runtime |
| 22 |
|
| 23 |
RUN yum install -y gdb strace |
| 24 |
|
| 25 |
RUN yum install -y epel-release |
| 26 |
RUN yum install -y mbedtls |
| 27 |
|
| 28 |
RUN groupadd app && useradd -g app app |
| 29 |
COPY --chown=app:app --from=build /usr/local/bin/ws /usr/local/bin/ws |
| 30 |
RUN chmod +x /usr/local/bin/ws |
| 31 |
RUN ldd /usr/local/bin/ws |
| 32 |
|
| 33 |
# Copy source code for gcc |
| 34 |
COPY --chown=app:app --from=build /opt /opt |
| 35 |
|
| 36 |
# Now run in usermode |
| 37 |
USER app |
| 38 |
WORKDIR /home/app |
| 39 |
|
| 40 |
ENTRYPOINT ["ws"] |
| 41 |
EXPOSE 8008 |