Skip to content

Commit ebb31b4

Browse files
committed
docker build fixes
1 parent 6904dd3 commit ebb31b4

File tree

4 files changed

+40
-1
lines changed

4 files changed

+40
-1
lines changed

Dockerfile

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
FROM alpine as build
2+
3+
RUN apk add --no-cache gcc g++ musl-dev linux-headers cmake openssl-dev
4+
RUN apk add --no-cache make
5+
RUN apk add --no-cache zlib-dev
6+
7+
RUN addgroup -S app && adduser -S -G app app
8+
RUN chown -R app:app /opt
9+
RUN chown -R app:app /usr/local
10+
11+
# There is a bug in CMake where we cannot build from the root top folder
12+
# So we build from /opt
13+
COPY --chown=app:app . /opt
14+
WORKDIR /opt
15+
16+
USER app
17+
RUN [ "make", "ws_install" ]
18+
19+
FROM alpine as runtime
20+
21+
RUN apk add --no-cache libstdc++
22+
23+
RUN addgroup -S app && adduser -S -G app app
24+
COPY --chown=app:app --from=build /usr/local/bin/ws /usr/local/bin/ws
25+
RUN chmod +x /usr/local/bin/ws
26+
RUN ldd /usr/local/bin/ws
27+
28+
# Now run in usermode
29+
USER app
30+
WORKDIR /home/app
31+
32+
ENTRYPOINT ["ws"]
33+
EXPOSE 8008
34+
CMD ["--help"]

docker/Dockerfile.alpine

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ COPY --chown=app:app . /opt
1414
WORKDIR /opt
1515

1616
USER app
17-
RUN [ "make" ]
17+
RUN [ "make", "ws_install" ]
1818

1919
FROM alpine as runtime
2020

ixsentry/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ add_library(ixsentry STATIC
1818

1919
set(IXSENTRY_INCLUDE_DIRS
2020
.
21+
..
2122
../third_party
2223
../third_party/spdlog/include)
2324

makefile

+4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ brew:
1414
ws:
1515
mkdir -p build && (cd build ; cmake -DCMAKE_BUILD_TYPE=Debug -DUSE_TLS=1 -DUSE_WS=1 .. ; make -j 4)
1616

17+
ws_install:
18+
mkdir -p build && (cd build ; cmake -DCMAKE_BUILD_TYPE=Debug -DUSE_TLS=1 -DUSE_WS=1 .. ; make -j 4 install)
19+
1720
ws_openssl:
1821
mkdir -p build && (cd build ; cmake -DCMAKE_BUILD_TYPE=Debug -DUSE_TLS=1 -DUSE_WS=1 -DUSE_OPEN_SSL=1 .. ; make -j 4)
1922

@@ -47,6 +50,7 @@ docker_test:
4750
docker build -f docker/Dockerfile.debian -t bsergean/ixwebsocket_test:build .
4851

4952
docker:
53+
git clean -dfx
5054
docker build -t ${IMG} .
5155
docker tag ${IMG} ${BUILD}
5256

0 commit comments

Comments
 (0)