docker build fixes

This commit is contained in:
Benjamin Sergeant 2019-10-26 11:47:08 -07:00
parent 081dd2c4bb
commit 85e00a195c
4 changed files with 40 additions and 1 deletions

34
Dockerfile Normal file
View File

@ -0,0 +1,34 @@
FROM alpine 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" ]
FROM alpine as runtime
RUN apk add --no-cache libstdc++
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
# Now run in usermode
USER app
WORKDIR /home/app
ENTRYPOINT ["ws"]
EXPOSE 8008
CMD ["--help"]

View File

@ -14,7 +14,7 @@ COPY --chown=app:app . /opt
WORKDIR /opt
USER app
RUN [ "make" ]
RUN [ "make", "ws_install" ]
FROM alpine as runtime

View File

@ -18,6 +18,7 @@ add_library(ixsentry STATIC
set(IXSENTRY_INCLUDE_DIRS
.
..
../third_party
../third_party/spdlog/include)

View File

@ -14,6 +14,9 @@ brew:
ws:
mkdir -p build && (cd build ; cmake -DCMAKE_BUILD_TYPE=Debug -DUSE_TLS=1 -DUSE_WS=1 .. ; make -j 4)
ws_install:
mkdir -p build && (cd build ; cmake -DCMAKE_BUILD_TYPE=Debug -DUSE_TLS=1 -DUSE_WS=1 .. ; make -j 4 install)
ws_openssl:
mkdir -p build && (cd build ; cmake -DCMAKE_BUILD_TYPE=Debug -DUSE_TLS=1 -DUSE_WS=1 -DUSE_OPEN_SSL=1 .. ; make -j 4)
@ -47,6 +50,7 @@ docker_test:
docker build -f docker/Dockerfile.debian -t bsergean/ixwebsocket_test:build .
docker:
git clean -dfx
docker build -t ${IMG} .
docker tag ${IMG} ${BUILD}