-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
47 lines (35 loc) · 1005 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# FROM golang:alpine3.15 AS development
FROM docker.io/golang:1.21-alpine3.18 AS development
ARG arch=x86_64
# ENV CGO_ENABLED=0
WORKDIR /go/src/app/
COPY . /go/src/app/
RUN apk update && apk add --no-cache \
llvm \
clang \
llvm-static \
llvm-dev \
make \
libbpf \
libbpf-dev \
musl-dev
RUN mkdir -p /build/ && \
make all && \
cp ./bin/* /build/
ENV PATH=$PATH:/build
# This entrypoint is just to keep the container running
# for development and debuging purposes
ENTRYPOINT ["tail", "-f", "/dev/null"]
#----------------------------#
FROM docker.io/alpine:3.18.4 AS test
WORKDIR /app/
COPY --from=development /build .
RUN apk update && apk add iperf3 iproute2 curl
ENTRYPOINT ["./bittwister"]
#----------------------------#
FROM docker.io/alpine:3.18.4 AS production
WORKDIR /app/
COPY --from=development /build .
RUN apk update && apk add iproute2 curl
ENV SERVE_ADDR="localhost:9001"
CMD ["sh", "-c", "./bittwister serve --serve-addr ${SERVE_ADDR}"]