Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve docker build files #655

Merged
merged 1 commit into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ccpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
- name: prepare
run: git submodule update --init
- name: build-static
run: sudo docker build -t sipp-build docker && sudo docker run -v $PWD:/src sipp-build
run: docker build -f docker/Dockerfile --output=. --target=bin .
- uses: actions/[email protected]
with:
name: sipp
Expand Down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ the following commands:

```
git submodule update --init
docker build -t sipp-build -f docker/Dockerfile docker
docker run --rm -v $PWD:/src sipp-build
docker build -t sipp -f docker/Dockerfile --output=. --target=bin .
```

# Support
Expand Down Expand Up @@ -100,8 +99,7 @@ list](https://lists.sourceforge.net/lists/listinfo/sipp-users).
(for ~rcX) with a period.
* Create a static binary and upload this to github as well:
```
sudo docker build -t sipp-build docker &&
sudo docker run -it -v $PWD:/src sipp-build
docker build -t sipp -f docker/Dockerfile --output=. --target=bin .
```
* Note that the static build is broken at the moment. See `ldd sipp`.

Expand Down
29 changes: 26 additions & 3 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
FROM alpine:3.18
# Usage (from within the git repo):
# git submodule update --init
# docker build -t sipp -f docker/Dockerfile .

FROM alpine:3.19 AS build

RUN apk add --no-cache \
binutils \
Expand All @@ -11,6 +15,25 @@ RUN apk add --no-cache \
libpcap-dev \
make \
ncurses-dev \
ncurses-static
ncurses-static \
ninja

WORKDIR /sipp
COPY CMakeLists.txt ./
COPY src src
COPY include include
COPY gtest gtest
RUN --mount=type=bind,target=.git,source=.git \
cmake . -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_STATIC=1 \
-DUSE_PCAP=1 \
-DUSE_GSL=1
RUN ninja

FROM scratch AS bin
COPY --from=build /sipp/sipp /sipp

CMD cd /src && rm -f CMakeCache.txt && cmake . -DBUILD_STATIC=1 -DUSE_PCAP=1 -DUSE_GSL=1 && make
FROM alpine:3.19
CMD ["sipp"]
COPY --from=build /sipp/sipp /usr/local/bin/sipp
51 changes: 34 additions & 17 deletions docker/Dockerfile.full
Original file line number Diff line number Diff line change
@@ -1,29 +1,46 @@
FROM alpine:3.18
# Usage (from within the git repo):
# git submodule update --init
# docker build -t sipp:full -f docker/Dockerfile.full .

FROM alpine:3.19 AS build

RUN apk add --no-cache \
binutils \
make \
cmake \
gcc \
g++ \
gcc \
git \
ncurses-dev \
ncurses-static \
libpcap-dev \
gsl-dev \
gsl-static \
openssl-dev \
openssl-libs-static \
libpcap-dev \
linux-headers \
lksctp-tools-dev \
lksctp-tools-static
lksctp-tools-static \
make \
ncurses-dev \
ncurses-static \
ninja \
openssl-dev \
openssl-libs-static

CMD cd /src \
&& rm -f CMakeCache.txt \
&& cmake . -DBUILD_STATIC=1 -DUSE_PCAP=1 -DUSE_GSL=1 -DUSE_SSL=1 -DUSE_SCTP=1 \
&& make
WORKDIR /sipp
COPY CMakeLists.txt ./
COPY src src
COPY include include
COPY gtest gtest
RUN --mount=type=bind,target=.git,source=.git \
cmake . -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_STATIC=1 \
-DUSE_PCAP=1 \
-DUSE_GSL=1 \
-DUSE_SSL=1 \
-DUSE_SCTP=1
RUN ninja

# Usage (from within the git repo):
# git submodule update --init
# docker build -t sipp-build -f docker/Dockerfile.full docker
# docker run -v $PWD:/src sipp-build
FROM scratch AS bin
COPY --from=build /sipp/sipp /sipp

FROM alpine:3.19
CMD ["sipp"]
COPY --from=build /sipp/sipp /usr/local/bin/sipp
Loading