mirror of
https://github.com/bettercap/bettercap
synced 2025-08-19 04:59:25 -07:00
Use Docker multi-stage build
This commit is contained in:
parent
293092be17
commit
98a00ab80e
1 changed files with 14 additions and 12 deletions
26
Dockerfile
26
Dockerfile
|
@ -1,23 +1,25 @@
|
||||||
FROM iron/go:dev
|
# build stage
|
||||||
MAINTAINER Simone Margaritelli <https://evilsocket.net/>
|
FROM golang:1.10-alpine AS build-env
|
||||||
|
|
||||||
ENV GOPATH=/gocode
|
ENV GOPATH=/gocode
|
||||||
ENV SRC_DIR=/gocode/src/github.com/bettercap/bettercap
|
ENV SRC_DIR=/gocode/src/github.com/bettercap/bettercap
|
||||||
COPY . $SRC_DIR
|
|
||||||
|
|
||||||
WORKDIR $SRC_DIR
|
|
||||||
|
|
||||||
RUN apk add --update ca-certificates
|
|
||||||
RUN apk add --no-cache --update bash iptables build-base libpcap-dev python
|
|
||||||
|
|
||||||
# As Alpine Linux uses a different folder, we need this
|
# As Alpine Linux uses a different folder, we need this
|
||||||
# ugly hack in order to compile gopacket statically
|
# ugly hack in order to compile gopacket statically
|
||||||
# https://github.com/bettercap/bettercap/issues/106
|
# https://github.com/bettercap/bettercap/issues/106
|
||||||
RUN mkdir -p /usr/lib/x86_64-linux-gnu/
|
RUN apk add --update ca-certificates && \
|
||||||
RUN cp /usr/lib/libpcap.a /usr/lib/x86_64-linux-gnu/libpcap.a
|
apk add --no-cache --update bash iptables build-base libpcap-dev git python && \
|
||||||
|
mkdir -p /usr/lib/x86_64-linux-gnu/ && \
|
||||||
|
cp /usr/lib/libpcap.a /usr/lib/x86_64-linux-gnu/libpcap.a
|
||||||
|
|
||||||
|
WORKDIR $SRC_DIR
|
||||||
|
ADD . $SRC_DIR
|
||||||
RUN make deps
|
RUN make deps
|
||||||
RUN make
|
RUN make
|
||||||
|
|
||||||
|
# final stage
|
||||||
|
FROM alpine
|
||||||
|
RUN apk add --no-cache --update bash libpcap-dev
|
||||||
|
COPY --from=build-env /gocode/src/github.com/bettercap/bettercap/bettercap /app/
|
||||||
|
WORKDIR /app
|
||||||
EXPOSE 80 443 53 5300 8080 8081 8082 8083 8000
|
EXPOSE 80 443 53 5300 8080 8081 8082 8083 8000
|
||||||
ENTRYPOINT ["./bettercap"]
|
ENTRYPOINT ["/app/bettercap"]
|
Loading…
Add table
Add a link
Reference in a new issue