Skip to content
This repository was archived by the owner on Nov 10, 2023. It is now read-only.

Commit 04c3479

Browse files
committed
Build as separate image with ipv6 support
1 parent a759388 commit 04c3479

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ COPY . .
55
RUN go build -o /tracetrout -ldflags='-s -w'
66

77
FROM alpine:3.7
8-
RUN apk add --no-cache iptables ip6tables libnetfilter_queue
8+
ARG IPV6_SUPPORT
9+
RUN apk add --no-cache iptables libnetfilter_queue ${IPV6_SUPPORT:+ip6tables}
910
WORKDIR /tracetrout
1011
COPY entrypoint.sh .
1112
COPY --from=builder /tracetrout .

circle.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,18 @@ jobs:
1010
- setup_remote_docker:
1111
version: 17.06.0-ce
1212
- run: docker build -t ${DOCKER_HUB_IMAGE} .
13+
- run: docker build --build-arg IPV6_SUPPORT=1 -t ${DOCKER_HUB_IMAGE}:ipv6 .
1314
- deploy:
1415
name: Deploy the image to Docker Hub
1516
command: |
1617
if echo -n "${CIRCLE_TAG}" | grep -Eq ^v[0-9]+\.[0-9]+\.[0-9]+$; then
1718
docker tag ${DOCKER_HUB_IMAGE} ${DOCKER_HUB_IMAGE}:${CIRCLE_TAG}
19+
docker tag ${DOCKER_HUB_IMAGE}:ipv6 ${DOCKER_HUB_IMAGE}:${CIRCLE_TAG}-ipv6
1820
docker login -u ${DOCKER_HUB_USER} -p ${DOCKER_HUB_PASS}
1921
docker push ${DOCKER_HUB_IMAGE}:${CIRCLE_TAG}
2022
docker push ${DOCKER_HUB_IMAGE}
23+
docker push ${DOCKER_HUB_IMAGE}:${CIRCLE_TAG}-ipv6
24+
docker push ${DOCKER_HUB_IMAGE}:ipv6
2125
fi
2226
2327
deployment:

entrypoint.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
set -e
22

33
for CMD in iptables ip6tables; do
4+
command -v ${CMD} > /dev/null 2>&1 || continue
5+
46
"${CMD}" -A INPUT -t mangle -j CONNMARK --restore-mark
57
"${CMD}" -A INPUT -t mangle -m mark ! --mark 0 -j ACCEPT
68
"${CMD}" -A INPUT -t mangle -p tcp --dport "${PORT}" -j MARK --set-mark 0x10000

0 commit comments

Comments
 (0)