diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 9959d7be..00000000 --- a/Dockerfile +++ /dev/null @@ -1,39 +0,0 @@ -FROM alpine:3.11 as build - -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" ] - -FROM alpine:3.11 as runtime - -RUN apk add --no-cache libstdc++ -RUN apk add --no-cache strace - -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 - -# Now run in usermode -USER app -WORKDIR /home/app - -ENTRYPOINT ["ws"] -EXPOSE 8008 -CMD ["--help"] diff --git a/Dockerfile b/Dockerfile new file mode 120000 index 00000000..54bb7cd9 --- /dev/null +++ b/Dockerfile @@ -0,0 +1 @@ +docker/Dockerfile.centos \ No newline at end of file diff --git a/docker/Dockerfile.alpine b/docker/Dockerfile.alpine index ab6dda67..810f236f 100644 --- a/docker/Dockerfile.alpine +++ b/docker/Dockerfile.alpine @@ -1,4 +1,4 @@ -FROM alpine as build +FROM alpine:3.11 as build RUN apk add --no-cache gcc g++ musl-dev linux-headers cmake openssl-dev RUN apk add --no-cache make @@ -15,20 +15,25 @@ WORKDIR /opt USER app RUN [ "make", "ws_install" ] +RUN [ "rm", "-rf", "build" ] -FROM alpine as runtime +FROM alpine:3.11 as runtime RUN apk add --no-cache libstdc++ +RUN apk add --no-cache strace 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 + # Now run in usermode USER app WORKDIR /home/app ENTRYPOINT ["ws"] EXPOSE 8008 -CMD ["--help"] +C diff --git a/docker/Dockerfile.centos b/docker/Dockerfile.centos new file mode 100644 index 00000000..abdb4b4d --- /dev/null +++ b/docker/Dockerfile.centos @@ -0,0 +1,35 @@ +FROM centos:8 as build + +RUN yum install -y gcc-c++ make cmake zlib-devel openssl-devel redhat-rpm-config + +RUN groupadd app && useradd -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" ] + +FROM centos:8 as runtime + +RUN yum install -y gdb strace + +RUN groupadd app && useradd -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 + +# Now run in usermode +USER app +WORKDIR /home/app + +ENTRYPOINT ["ws"] +EXPOSE 8008