mirror of
				https://github.com/gravitl/netmaker.git
				synced 2025-11-04 11:39:22 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			57 lines
		
	
	
	
		
			1.3 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
			
		
		
	
	
			57 lines
		
	
	
	
		
			1.3 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
FROM debian:buster as builder
 | 
						|
# add glib support daemon manager
 | 
						|
 | 
						|
RUN apt update -y && apt install -y wget bash gcc musl-dev openssl golang git build-essential libmnl-dev iptables
 | 
						|
 | 
						|
RUN wget -O go.tgz https://go.dev/dl/go1.18.linux-amd64.tar.gz
 | 
						|
 | 
						|
RUN tar -C /usr/local -xzf go.tgz
 | 
						|
 | 
						|
WORKDIR /usr/local/go/src
 | 
						|
 | 
						|
RUN chmod +x make.bash
 | 
						|
 | 
						|
RUN ./make.bash
 | 
						|
 | 
						|
ENV PATH="/usr/local/go/bin:$PATH"
 | 
						|
 | 
						|
ENV GOPATH=/opt/go/
 | 
						|
 | 
						|
ENV PATH=$PATH:$GOPATH/bin
 | 
						|
 | 
						|
WORKDIR /app
 | 
						|
 | 
						|
COPY . .
 | 
						|
 | 
						|
ENV GO111MODULE=auto
 | 
						|
 | 
						|
RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 /usr/local/go/bin/go build -ldflags="-w -s" -o netclient-app netclient/main.go
 | 
						|
 | 
						|
WORKDIR /root/
 | 
						|
 | 
						|
RUN git clone https://git.zx2c4.com/wireguard-go && \
 | 
						|
    cd wireguard-go && \
 | 
						|
    make && \
 | 
						|
    make install
 | 
						|
 | 
						|
ENV WITH_WGQUICK=yes
 | 
						|
RUN git clone https://git.zx2c4.com/wireguard-tools && \
 | 
						|
    cd wireguard-tools && \
 | 
						|
    cd src && \
 | 
						|
    make && \
 | 
						|
    make install
 | 
						|
 | 
						|
 | 
						|
FROM debian:buster
 | 
						|
 | 
						|
WORKDIR /root/
 | 
						|
 | 
						|
RUN apt update -y && apt install -y bash curl wget traceroute procps dnsutils iptables openresolv iproute2
 | 
						|
COPY --from=builder /usr/bin/wireguard-go /usr/bin/wg* /usr/bin/
 | 
						|
COPY --from=builder /app/netclient-app ./netclient
 | 
						|
COPY --from=builder /app/scripts/netclient.sh .
 | 
						|
RUN chmod 0755 netclient && chmod 0755 netclient.sh
 | 
						|
 | 
						|
ENV WG_QUICK_USERSPACE_IMPLEMENTATION=wireguard-go
 | 
						|
 | 
						|
ENTRYPOINT ["/bin/bash", "./netclient.sh"]
 |